How To Use "Qqplot": X: Independent Variable, Y: Dependent Variable
How To Use "Qqplot": X: Independent Variable, Y: Dependent Variable
the coefficients
and
: regression coefficients.
x : predictor variable
y : response variable
meaning of "linear" applies to the way the regression coefficients are used.
meaning of simple : only one predictor variable is used.
The estimated regression line :
the predicted value :
residual : the difference between the observed value and the predicted value
( x x)( y y )
( x x)
i
x
y
1
=
Example 3.5: The regression line for the Maple wood home data
homedata(UsingR) : a strong linear trend between the 1970 & and the 2000 assessments.
attach(homedata)
lm(y2000 ~ y1970)
fit1 = lm(y2000 ~ y1970) # save the result
fit1
abline(fit1)
Remark) abline() function can add other lines too :
abline(a,b) : the line y=a+bx
abline(h=c) : the horizontal line y=c
abline(v=c) : the vertical line x=c
Eg. Find the predicted and residual value at the data point (55100, 130200)
To specify the x value, a data frame is required with properly named variables.
predict(fit1, data.frame(y1970=55100))
130200 - predict(fit1, data.frame(y1970=55100)) # residual
height.sq = kid.weights$height^2
plot(weight ~ height.sq, data=kid.weights)
fit2 = lm(weight ~ height.sq, data=kid.weights)
abline(fit2)
fit2
residuals(res)[50]
Buchanan received 2,610 of Gores votes. Many more than the 567 that decided the state
and the presidency.
3.4.6