Professional Documents
Culture Documents
b)
Here is the summary of the fit:
> summary(fit)
Call:
lm(formula = teengamb$gamble ~ teengamb$income)
Residuals:
Min
1Q Median
3Q
Max
-46.020 -11.874 -3.757 11.934 107.120
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)
-6.325
6.030 -1.049
0.3
teengamb$income 5.520
1.036 5.330 3.05e-06 ***
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Residual standard error: 24.95 on 45 degrees of freedom
Multiple R-squared: 0.387,
Adjusted R-squared: 0.3734
F-statistic: 28.41 on 1 and 45 DF, p-value: 3.045e-06
C)
The LS estimators are the same.
> bhat
[,1]
(Intercept)
-6.324559
teengamb$income 5.520485
They are:
D)
38.7% is explained by the covariate
E)
Observation 24 has the largest residual of 107.1197.
F)
The mean and the median are
> mean(resid)
[1] -5.203801e-16
> median(resid)
[1] -3.757382
The mean is near zero which is one of our assumptions for residuals. The mean and the median are a
little far from each other, this goes against our assumption of normality because in a normal distribution
the mean and the median are the same.
G)
The multiple correlation coefficient is
> sqrt(0.387)
[1] 0.6220932
I)
The plot for the elliptical confidence region is
J)
6)
Here are the histograms for the data sets. From the graphs we can see that salary and experience are
symmetric about their mean values.
B)
Here are the plots of salary vs the other covariates. There is a clear relationship between grants and
salary. The relationship between the other graphs seem to be weaker.
C)
Here is the fitted data
> summary(salfit)
Call:
lm(formula = salary ~ pubqual + exp + grant)
Residuals:
Min
1Q Median
3Q
Max
-1.2045 -0.7203 -0.2228 0.6446 1.7378
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3.64250 2.00988 -1.812 0.08426 .
pubqual
-0.06757 0.03482 -1.940 0.06587 .
exp
-0.25975 0.20295 -1.280 0.21455
grant
0.31023 0.08449 3.672 0.00142 **
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Residual standard error: 0.9318 on 21 degrees of freedom
Multiple R-squared: 0.5332, Adjusted R-squared: 0.4666
D)
It seems to be fitted pretty well. Adjusted R^2 is 47%.
E)
As we saw in the graphs, the number success in obtaining grants is the only one that is significant.
F)
The confidence intervals are shown below:
> confint(salfit,level=.90)
5%
95 %
(Intercept) -7.1009842 -0.184022886
pubqual
-0.1274903 -0.007651218
exp
-0.6089731 0.089474792
grant
0.1648437 0.455616502
The hypothesis test that we have to look at here is B1=0 and B2=0. Since they are in the confidence
region we fail to reject the null that the coefficients are not zero.
H)
> p1
$fit
1
2
3
4
fit
lwr
upr
-7.624190 -17.47420 2.2258216
-9.979022 -23.74413 3.7860911
-5.269358 -11.50307 0.9643537
-14.931345 -36.87058 7.0078888
$se.fit
1
2
3
4
4.736462 6.619072 2.997533 10.549667
$df
[1] 21
$residual.scale
[1] 0.9318155
>
>
>
>
1
2
3
4
I)
We cannot say anything about the salary. The model does not make sense.
> p2
$fit
fit
lwr
upr
1 -4.262172 -10.3172 1.792859
$se.fit
[1] 2.75848
$df
[1] 21
$residual.scale
[1] 0.9318155