Stat 511 HW 6 sol S09

# Stat 511 HW 6 sol S09 - STAT 511 HW#6 SPRING 2009 PROBLEM 1

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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: STAT 511 HW#6 SPRING 2009 PROBLEM 1: y<-c(6.0,6.1,8.6,7.1,6.5,7.4,9.4,9.9,9.5,7.5,6.4,9.1,8.7) A<-c(1,1,1,1,1,1,2,2,2,2,2,2,2) B<-c(1,1,2,2,2,2,1,1,2,2,3,3,3) options(contrasts=c("contr.sum","contr.sum")) a) The pooled variance from the 5 samples (of sizes 2,4,2,2, and 3) is 1.089(standard error =1.044). An exact 95% confidence interval for g is G ¡ ¢.£¤¥∗¤ ¦ §.¨©ª,«§ ¬ , ¡ ¢.£¤¥∗¤ ¦ §.§¬ª,«§ ¬ ­ =(0.705,2) ##Using lme A<-as.factor(A) B<-as.factor(B) lme.out<-lme(y~1,random=~1|A/B) summary(lme.out) Linear mixed-effects model fit by REML Data: NULL AIC BIC logLik 49.46496 51.40458 -20.73248 Random effects: Formula: ~1 | A (Intercept) StdDev: 1.165728 Formula: ~1 | B %in% A (Intercept) Residual StdDev: 0.4955114 1.056588 Fixed effects: y ~ 1 Value Std.Error DF t-value p-value (Intercept) 7.79261 0.9051327 8 8.609356 0 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.8490691 -0.6716102 0.1801882 0.7063261 1.3159194 Number of Observations: 13 Number of Groups: A B %in% A 2 5 intervals(lme.out) Approximate 95% confidence intervals Fixed effects: lower est. upper (Intercept) 5.70537 7.79261 9.87985 Random Effects: Level: A lower est. upper sd((Intercept)) 0.2184694 1.165728 6.220191 Level: B lower est. upper sd((Intercept)) 0.03991159 0.4955114 6.151885 Within-group standard error: lower est. upper 0.6391959 1.0565880 1.7465355 An approximate 95% confidence interval for g is (0.6391959 , 1.7465355) ##Using lmer lmer.out<- lmer(y ~ (1|A) + (1|A:B)) summary(lmer.out) Linear mixed model fit by REML Formula: y ~ (1 | A) + (1 | A:B) AIC BIC logLik deviance REMLdev 49.46 51.72 -20.73 43.06 41.46 Random effects: Groups Name Variance Std.Dev. A:B (Intercept) 0.24553 0.49551 A (Intercept) 1.35892 1.16573 Residual 1.11638 1.05659 Number of obs: 13, groups: A:B, 5; A, 2 Fixed effects: Estimate Std. Error t value (Intercept) 7.7926 0.9051 8.61 sims <- mcmcsamp(lmer.out, 50000) HPDinterval(sims) \$fixef lower upper (Intercept) 5.006724 10.53065 \$ST lower upper [1,] 0 0.992304 [2,] 0 3.311172 \$sigma lower upper [1,] 0.7268979 1.814918 b) AA<-as.factor(A) BB<-as.factor(B) lm.out<-lm(y~1+AA/BB) summary(lm.out) Call: lm(formula = y ~ 1 + AA/BB) Residuals: Min 1Q Median 3Q Max -1.667e+00 -3.000e-01 4.612e-16 6.333e-01 1.200e+00 Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(>|t|) (Intercept) 8.0694 0.3293 24.503 8.22e-09 *** AA1 -0.6694 0.3293 -2.033 0.0765 . AA1:BB1 -1.3500 0.9040 -1.493 0.1737 AA2:BB1 0.9111 0.5857 1.556 0.1584 AA1:BB2 NA NA NA NA AA2:BB2 -0.2389 0.5857 -0.408 0.6941 Residual standard error: 1.044 on 8 degrees of freedom Multiple R-squared: 0.6286, Adjusted R-squared: 0.4429 F-statistic: 3.385 on 4 and 8 DF, p-value: 0.06686 Note that the estimate of g (residual standard error = 1.044) produced by lm.out is exactly the one based on the mean square error referred in part a). is exactly the one based on the mean square error referred in part a)....
View Full Document

## This note was uploaded on 02/11/2012 for the course STAT 511 taught by Professor Staff during the Spring '08 term at Iowa State.

### Page1 / 12

Stat 511 HW 6 sol S09 - STAT 511 HW#6 SPRING 2009 PROBLEM 1

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

View Full Document
Ask a homework question - tutors are online