Load the sample data.

The `flu`

dataset array has a `Date`

variable, and 10 variables containing estimated influenza rates (in 9 different regions, estimated from Google® searches, plus a nationwide estimate from the CDC).

To fit a linear-mixed effects model, your data must be in a properly formatted dataset array. To fit a linear mixed-effects model with the influenza rates as the responses and region as the predictor variable, combine the nine columns corresponding to the regions into an array. The new dataset array, `flu2`

, must have the response variable, `FluRate`

, the nominal variable, `Region`

, that shows which region each estimate is from, and the grouping variable `Date`

.

Fit a linear mixed-effects model with fixed effects for the region and a random intercept that varies by `Date`

.

lme =
Linear mixed-effects model fit by ML
Model information:
Number of observations 468
Fixed effects coefficients 9
Random effects coefficients 52
Covariance parameters 2
Formula:
FluRate ~ 1 + Region + (1 | Date)
Model fit statistics:
AIC BIC LogLikelihood Deviance
318.71 364.35 -148.36 296.71
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF
{'(Intercept)' } 1.2233 0.096678 12.654 459
{'Region_MidAtl' } 0.010192 0.052221 0.19518 459
{'Region_ENCentral'} 0.051923 0.052221 0.9943 459
{'Region_WNCentral'} 0.23687 0.052221 4.5359 459
{'Region_SAtl' } 0.075481 0.052221 1.4454 459
{'Region_ESCentral'} 0.33917 0.052221 6.495 459
{'Region_WSCentral'} 0.069 0.052221 1.3213 459
{'Region_Mtn' } 0.046673 0.052221 0.89377 459
{'Region_Pac' } -0.16013 0.052221 -3.0665 459
pValue Lower Upper
1.085e-31 1.0334 1.4133
0.84534 -0.092429 0.11281
0.3206 -0.050698 0.15454
7.3324e-06 0.13424 0.33949
0.14902 -0.02714 0.1781
2.1623e-10 0.23655 0.44179
0.18705 -0.033621 0.17162
0.37191 -0.055948 0.14929
0.0022936 -0.26276 -0.057514
Random effects covariance parameters (95% CIs):
Group: Date (52 Levels)
Name1 Name2 Type Estimate
{'(Intercept)'} {'(Intercept)'} {'std'} 0.6443
Lower Upper
0.5297 0.78368
Group: Error
Name Estimate Lower Upper
{'Res Std'} 0.26627 0.24878 0.285

Test the hypothesis that the random effects-term for week 10/9/2005 is zero.

Refit the model this time with a random intercept and slope.

Test the hypothesis that the combined coefficient of region `WNCentral`

for week 10/9/2005 is zero.

Also return the $$F$$-statistic with the numerator and denominator degrees of freedom.

Repeat the test using the Satterthwaite approximation for the denominator degrees of freedom.