hw2-soln

# hw2-soln - STOR 664 Homework 2 Solution Part A. Exercise...

This preview shows pages 1–3. Sign up to view the full content.

STOR 664 Homework 2 Solution Part A. Exercise (Faraway book) Ch.2 Ex.1 > data(teengamb) > attach(teengamb) > tgl<-lm(gamble ~ sex+status+income+verbal) > summary(tgl) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 22.55565 17.19680 1.312 0.1968 sex -22.11833 8.21111 -2.694 0.0101 * status 0.05223 0.28111 0.186 0.8535 income 4.96198 1.02539 4.839 1.79e-05 *** verbal -2.95949 2.17215 -1.362 0.1803 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 22.69 on 42 degrees of freedom Multiple R-squared: 0.5267, Adjusted R-squared: 0.4816 F-statistic: 11.69 on 4 and 42 DF, p-value: 1.815e-06 (a) The percentage of variation in the response is given by the Multiple R-squared, which is 52.67%. (b) The 24th case has the largest residual. > which.max(tgl\$residuals) (c) The mean of the residuals is almost 0( ≈ - 2 . 486 × 10 - 17 ) and the median is - 1 . 451. > mean(tgl\$residuals) > median(tgl\$residuals) (d) The correlation of the residuals with ﬁtted values is 2 . 586 × 10 - 17 . > cor(tgl\$residuals,tgl\$fitted.values) (e) The correlation of the residuals with the income is - 5 . 027 × 10 - 17 . > cor(tgl\$residuals,income) (f) Based on the summary, the ﬁtted model can be explicitly written as: gamble = 22 . 55565 - 22 . 11833 × sex + 0 . 05223 × status + 4 . 96198 × income - 2 . 95949 × verbal If all the predictors except sex are held constant, the diﬀerence in predicted expenditure on gambling between male (sex=0) and female (sex=1) will be equal to the regression coeﬃcient of sex, i.e., - 22 . 11833. Therefore whenever sex changes from male (sex=0) to female (sex=1), the value of gamble decreases by 22.11833. In other words, according to the current regression model, a female spends \$22.11833 less than a comparable (i.e., other predictors being held constant) male on gambling. 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Part B. Ch.3 Ex.2 The model is Y = X β + ² where Y = ( y 1 ,y 2 ,...,y n ) 0 , X = x 11 x 12 x 21 x 22 . . . . . . x n 1 x n 2 , β = ( β 1 2 ) 0 , ² = ( ² 1 2 ,...,² n ) . Using those calculations, ( X 0 X ) - 1 = 1 x 2 i 1 2 i 2 - ( x i 1 x i 2 ) 2 ± x 2 i 2 - x i 1 x i 2 - x i 1 x i 2 x 2 i 1 , X 0 Y = ± ∑ x i 1 y i x i 2 y i . Least Squared Estimation of β is given by Normal equation; ˆ β = ( X 0 X ) - 1 X 0 Y = 1 x 2 i 1 2 i 2 - ( x i 1 x i 2 ) 2 ± ∑ x 2 i 2 x i 1 y i - x i 1 x i 2 x i 2 y i - x i 1 x i 2 x i 1 y i + x 2 i 1 x i 2 y i Clearly estimates are unbiased and Cov( ˆ β ) = σ 2 ( X 0 X ) - 1 : Var( ˆ β 1 ) = σ 2 x 2 i 2 / A , Var( ˆ β 2 ) = σ 2 x 2 i 1 / A , Cov( ˆ β 1 , ˆ β 2 ) = - σ 2 x i 1 x i 2 / A where A = x 2 i 1 2 i 2 - ( x i 1 x i 2 ) 2 . Ch.3 Ex.4
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/17/2011 for the course STOR 664 taught by Professor Staff during the Fall '11 term at UNC.

### Page1 / 8

hw2-soln - STOR 664 Homework 2 Solution Part A. Exercise...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online