This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: STOR 664 Homework 1 Solution A. Exercise (Faraway book) Summary: > library(faraway) > data(teengamb) > teengamb$sex<-as.factor(teengamb$sex) > summary(teengamb) sex status income verbal gamble 0:28 Min. :18.00 Min. : 0.600 Min. : 1.00 Min. : 0.0 1:19 1st Qu.:28.00 1st Qu.: 2.000 1st Qu.: 6.00 1st Qu.: 1.1 Median :43.00 Median : 3.250 Median : 7.00 Median : 6.0 Mean :45.23 Mean : 4.642 Mean : 6.66 Mean : 19.3 3rd Qu.:61.50 3rd Qu.: 6.210 3rd Qu.: 8.00 3rd Qu.: 19.4 Max. :75.00 Max. :15.000 Max. :10.00 Max. :156.0 There are no missing values. From this summary we see that there were more males sampled than fe- males. We also see that the mean of gamble is much larger than the median, suggesting the distribution is right skewed or may have large outliers, which is likely since the maximum value is so much larger than the other quartile values. Histograms of the income variable and the gamble variable: > hist(teengamb$income) > hist(teengamb$gamble) As the summary above suggested, both the histograms are skewed to the right and there are a few large outliers. Pairwise scatter plots: > pairs(teengamb,col=as.numeric(teengamb$sex)+2) 1 It appears in this study that males tend to spend more on gambling than females. Also, the variables verbal and status look like they may be slightly positively correlated and gamble and income may also be correlated. The following command confirms those two correlations are greater than 0.5. > cor(teengamb[,-1]) status income verbal gamble status 1.00000000 -0.2750340 0.5316102 -0.05042081 income -0.27503402 1.0000000 -0.1755707 0.62207690 verbal 0.53161022 -0.1755707 1.0000000 -0.22005619 gamble -0.05042081 0.6220769 -0.2200562 1.00000000 The correlation between gamble and income makes sense, because people who make more money have more money to spend on gambling. This concludes the preliminary analysis of this data. B. Ex. 2.1 = y i /n is apparently linear and unbiased. To show it has minimum variance among all linear, unbiased estimators, let = n i =1 c i y i be any estimator of these properties. Then, from unbiasedness, we get c i = 1 , c i ( x i x ) = 0. Since Cov ( , ) = i c i j 1 n Cov ( y i , y j ) i 1 n 2 V ar ( y i ) = i c i 1 n 2 i 1 n 2 2 = 0, we have V ar ( ) = V ar ( + ) = V ar ( ) + V ar ( ) + 0 > V ar ( ) showing that has the smallest variance, and is the BLUE....
View Full 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.
- Fall '11