by David Lillis, Ph.D.
Last time we created two variables and used the lm() command to perform a least squares regression on them, and diagnosing our regression using the plot() command.
Just as we did last time, we perform the regression using lm(). This time we store it as an object M. (more…)
by David Lillis, Ph.D.
In Part 3 and Part 4 we used the lm() command to perform least squares regressions. We saw how to check for non-linearity in our data by fitting polynomial models and checking whether they fit the data better than a linear model. Now let’s see how to fit an exponential model in R.
As before, we will use a data set of counts (atomic disintegration events that take place within a radiation source), taken with a Geiger counter at a nuclear plant.
The counts were registered over a 30 second period for a short-lived, man-made radioactive compound. We read in the data and subtract the background count of 623.4 counts per second in order to obtain
(more…)
by David Lillis, Ph.D.
In Part 1 we installed R and used it to create a variable and summarize it using a few simple commands. Today let’s re-create that variable and also create a second variable, and see what we can do with them.
As before, we take height to be a variable that describes the heights (in cm) of ten people. Type the following code to the R command line to create this variable.
height = c(176, 154, 138, 196, 132, 176, 181, 169, 150, 175)
Now let’s take weight to be a variable that describes the weights (in kg) of
(more…)