Based on Applied Statistics with R by David Dalpiaz (https://github.com/daviddalpiaz/appliedstats)
cars
ExampleWe will use the small dataset cars
which comes with R and it availiable right away
cars
We want too examine the relationship between the speed of a car (speed
) and its stopping distance (dist
).
dist
and speed
. Describe what you see.plot(dist ~ speed, data = cars)
cars
with dist
as the response variable and speed
as the predictor variable. Plot it on top of the scatter plot. How does it fit?Examine the model fit with summary()
. Look at the different results from summary()
using names()
.
Verify the value of the \(t\) test statistic for \(\b_1\) and the two-sided p-value associated with that test statistic.
Use the confint()
function to obain the confidence interval for \(\beta_0\) and \(\beta_1\).
Verify the calculations that R is performing for the \(\beta_1\) interval.