# MATH 6643 Summer 2012 Applications of Mixed Models/Submitted sample exam questions

### From Wiki1

(22 intermediate revisions not shown) | |||

Line 79: | Line 79: | ||

'''Question 5:''' | '''Question 5:''' | ||

- | Explain the similarities and differences between within effects, between effects and clusters. | + | Explain the similarities and differences between within effects, between effects, contextual effects, compositional effects; and clusters. |

'''Question 5:''' | '''Question 5:''' | ||

Line 108: | Line 108: | ||

'''Early Chapters/Course Content:''' | '''Early Chapters/Course Content:''' | ||

+ | We learned about a simulation conducted in which the estimate of the slope from a mixed model (without contextual effect) was obtained varying the within-cluster variance (see figure below). What are the implications of this simulation study? | ||

+ | |||

+ | [[File:MixedModelSimResult.png|350px]] | ||

'''Later Chapters/Course Content:''' | '''Later Chapters/Course Content:''' | ||

- | Data is obtained from on the effects of two treatments (A and B). Data was recorded on symptoms weekly throughout | + | |

+ | Data is obtained from on the effects of two treatments (A and B). Data was recorded on symptoms weekly throughout 10 weeks of active treatment and then for 8 more weeks following termination of the treatment. A linear spline model is fit to the data and the following results were obtained: | ||

:: | :: | ||

<pre> | <pre> | ||

+ | |||

+ | sp <- function( x ) { | ||

+ | gsp( x, | ||

+ | knots = c( 10 ), # 1 knots => 2 intervals | ||

+ | degree = c( 1 , 1 ) , # linear in each interval | ||

+ | smooth = c( 0 ) # continuous at the knot | ||

+ | ) | ||

+ | } | ||

+ | |||

> fit <- lme( Symptom ~ sp(Weeks)*tx, random=~1+Weeks|id, data = d) | > fit <- lme( Symptom ~ sp(Weeks)*tx, random=~1+Weeks|id, data = d) | ||

> summary(fit) | > summary(fit) | ||

Line 155: | Line 168: | ||

:* Sketch the predicted trajectories. | :* Sketch the predicted trajectories. | ||

:* Bonus: How would you test whether there is a significant difference in the predicted symptom score at week 10 or week 18? | :* Bonus: How would you test whether there is a significant difference in the predicted symptom score at week 10 or week 18? | ||

+ | |||

+ | == Georges' Questions == | ||

+ | |||

+ | === Interpreting p-values === | ||

+ | Consider a regression of a continuous variable Y on a continuous variable X and a dichotomous factor coded with an indicator variable G. Consider a regression of Y on X and G with: | ||

+ | |||

+ | <math> \hat{Y} = \hat{\beta}_0 +\hat{\beta}_X X +\hat{\beta}_G G </math> | ||

+ | |||

+ | In the multiple regression of Y on X and G neither <math>\hat{\beta}_X</math> nor <math>\hat{\beta}_G</math> are significant. However the F-test for the hypothesis that both parameters are 0 yields a p-value of 0.002. | ||

+ | |||

+ | Sketch a plausible data set that could exhibit this phenomenon in data space with axes for Y and X and group membership indicated by different characters. Also sketch relevant confidence ellipses in <math>\beta_X , \beta_G</math> space. | ||

+ | |||

+ | === Multilevel models === | ||

+ | Consider a multilevel random slopes model of the form: | ||

+ | :<math>Y_i = X_i\gamma +Z_i u_i+ \epsilon_i\!</math> | ||

+ | with <math>u_i \sim N(0,G)\!</math>, <math>\epsilon_i \sim N(0,\sigma^2 I)\!</math> independent of <math>{{u}_{i}}\!</math>, <math>{{Z}_{i}}={{X}_{i}}\!</math>; independent for <math>i=1,\ldots ,M\!</math>. | ||

+ | |||

+ | Let | ||

+ | <math>{{\beta }_{i}}=\gamma +{{u}_{i}}\!</math>. | ||

+ | |||

+ | In the following questions, treat the macro level parameters | ||

+ | <math>\gamma ,\ {{\sigma }^{2}}\!</math> and <math>G\!</math> as they were fixed and known. | ||

+ | # Give an expression for the BLUE of <math>\beta_i\!</math> . | ||

+ | # Give an expression for the BLUP of <math>\beta_i\!</math> as a function of the BLUE and other non-random quantities. | ||

+ | # Describe how the BLUP is a shrinkage estimator based on the BLUE. | ||

+ | # For large <math>n_i\!</math> and relatively fixed variances for the values of X within each cluster, how will the BLUP behave relative to the BLUE? | ||

+ | # What are the implications for the BLUP if <math>G\!</math> is highly concentrated? | ||

+ | === Interpreting a factorization of G === | ||

+ | Consider a random coefficient model with a random intercept and random slope. Let the G matrix have the decomposition <math>G = AA'\!</math> where | ||

+ | : <math> A = | ||

+ | \left[ \begin{matrix} | ||

+ | {{a}_{0}} & {{a}_{01}} \\ | ||

+ | 0 & {{a}_{1}} \\ | ||

+ | \end{matrix} \right]</math> | ||

+ | |||

+ | Show that <math> a_0 </math> is the minimal standard deviation of random regression lines above and below the population regression line. | ||

+ | === Intrepreting output === | ||

+ | The following questions refer to the output below for a mixed model for the full high school math achievement data set. The model uses SES, SES.School which is the mean SES in the sample in each school, ‘female’ which is an individual level indicator variable and ‘Type’ which is three-level factor with levels “Coed”, “Girl” and “Boy” with the obvious definition and Sector which is a 2-level factor with levels “Catholic” and “Public”. | ||

+ | # Consider two Catholic ‘girl’ schools, one with mean SES = 0 and the other with mean SES = 1. Suppose the values of SES in the former school range from -1 to 1 and in the latter school from 0 to 2. Draw a graph showing the predicted MathAch in these two schools over the range of values of SES in each school. On your graph identify the value and location of the contextual effect of SES, the within school effect of SES and the compositional effect of SES. | ||

+ | # Suppose you were to refit the model without SES.School. What would you expect to happen to the coefficient for SES? Would it stay roughly the same, get bigger or get smaller, or is the change unpredictable? Explain. | ||

+ | # Suppose you want to perform an overall test of the importance of gender in the model, either within schools or between schools. Specify a hypothesis matrix that would perform this test. | ||

+ | # Estimate the difference between the predicted math achievement of a boy in a boys’ school versus a girl in a girls’ school. If you suspected that this is affected by the SES of the school, how would you modify the model to test this hypothesis? | ||

+ | |||

+ | [[Media:MATH_6643_Sample_exam_output_2.pdf]] | ||

+ | |||

+ | === Testing identifiability of the G and R models === | ||

+ | Consider a mixed model for data with a response variable Y and a single predictor X. Suppose that each cluster has size 2 and X is measured at the values 0 and 1. Is it possible to identify the parameters of a random slope model? What if each cluster had size 3 and X were observed at levels -1, 0 and +1? |

## Latest revision as of 11:22, 24 July 2012

**Question 1:**

Consider the following output:

> head(hs) school mathach ses Sex Minority Size Sector PRACAD DISCLIM 1 1317 12.862 0.882 Female No 455 Catholic 0.95 -1.694 2 1317 8.961 0.932 Female Yes 455 Catholic 0.95 -1.694 3 1317 4.756 -0.158 Female Yes 455 Catholic 0.95 -1.694 4 1317 21.405 0.362 Female Yes 455 Catholic 0.95 -1.694 5 1317 20.748 1.372 Female No 455 Catholic 0.95 -1.694 6 1317 18.362 0.132 Female Yes 455 Catholic 0.95 -1.694 > fit <- lme( mathach ~ ses * cvar(ses,school), hs, + random = ~ 1 + ses|school) > summary(fit) Linear mixed-effects model fit by REML Data: hs AIC BIC logLik 12846.85 12891.54 -6415.423 Random effects: Formula: ~1 + ses | school Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 1.6293867 (Intr) ses 0.6614903 -0.469 Residual 6.1109156 Fixed effects: mathach ~ ses * cvar(ses, school) Value Std.Error DF t-value p-value (Intercept) 12.681917 0.3054760 1935 41.51526 0.0000 ses 2.243374 0.2416545 1935 9.28339 0.0000 cvar(ses, school) 3.687892 0.7699000 38 4.79009 0.0000 ses:cvar(ses, school) 0.873953 0.5771829 1935 1.51417 0.1301 Correlation: (Intr) ses cv(,s) ses -0.188 cvar(ses, school) 0.022 -0.261 ses:cvar(ses, school) -0.258 0.065 0.014 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -3.2291287 -0.7433282 0.0306118 0.7770370 2.6906899 Number of Observations: 1977 Number of Groups: 40

- Identify the expression of the model in mathematical formula and the usual model assumption.
- Find out the variances of the group effects, residuals and the response.
- Sketch the estimated response function for a school with mean ses of 0.
- For what value of ses is the variance of mathach estimated to be minimized.

**Question 2:**

Longitudinal data analysis with mixed models: Consider a mixed model with random intercept and slope with respect to time, T. Suppose that the G matrix is

- Find the value of T for which the variance of Y is minimized and the minimum variance.
- Show that recentering T on this value (if known) turns the G matrix into one with only two free parameters.
- Sketch a data plot to show the location and value of the minimum standard deviation of lines.

**Question 3:**

Explain why would would want to add or *S**D*_{j} to a multilevel model.

**Question 4:**

Discuss the interpretation/ramifications of extreme ICC values in the design of a multilevel study.

**Question 5:**

Explain the similarities and differences between within effects, between effects, contextual effects, compositional effects; and clusters.

**Question 5:**

Discuss/explain the relationship between longitudinal data and hierarchical data with appropriate examples and theory.

**Question 6:**

Let Σ be symmetric. Show that Σ is positive-definite if and only there exists a non-singular matrix A such that Σ = AA'

**Question 7:**

Why do we study longitudinal and mixed models?

## Contents |

### Ryan's Questions

**Early Chapters/Course Content:**

What is Simpson's Paradox and how is it related to HLM? - Please describe the necessary relationships and sketch them accordingly.

Under what two conditions might someone be completely unconcerned with the possible problems associated with this paradox?

**Later Chapters/Course Content:**

In Chapter 11 Snijders & Bosker discuss the problem of optimal sample size in order to obtain accurate estimates of the ICC. Explain the reasoning behind the process of optimization for the hierarchical sample (assuming equal cluster sizes with a sample of size *M* with *N* clusters of size *n*).

### Carrie's Questions

**Early Chapters/Course Content:**

We learned about a simulation conducted in which the estimate of the slope from a mixed model (without contextual effect) was obtained varying the within-cluster variance (see figure below). What are the implications of this simulation study?

**Later Chapters/Course Content:**

Data is obtained from on the effects of two treatments (A and B). Data was recorded on symptoms weekly throughout 10 weeks of active treatment and then for 8 more weeks following termination of the treatment. A linear spline model is fit to the data and the following results were obtained:

sp <- function( x ) { gsp( x, knots = c( 10 ), # 1 knots => 2 intervals degree = c( 1 , 1 ) , # linear in each interval smooth = c( 0 ) # continuous at the knot ) } > fit <- lme( Symptom ~ sp(Weeks)*tx, random=~1+Weeks|id, data = d) > summary(fit) Linear mixed-effects model fit by REML Data: d AIC BIC logLik 15099.44 15153.18 -7539.719 Random effects: Formula: ~1 + Weeks | id Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 37.921194 (Intr) Weeks 2.395329 -0.218 Residual 23.285420 Fixed effects: Symptom ~ sp(Weeks) * tx Value Std.Error DF t-value p-value (Intercept) 131.84484 6.450470 1516 20.43957 0.0000 sp(Weeks)D1(0) -11.21889 0.508022 1516 -22.08346 0.0000 sp(Weeks)C(10).1 18.24584 0.571104 1516 31.94835 0.0000 txB -2.61621 9.122343 78 -0.28679 0.7750 sp(Weeks)D1(0):txB 1.55017 0.718452 1516 2.15765 0.0311 sp(Weeks)C(10).1:txB -4.83791 0.807664 1516 -5.99001 0.0000 Correlation: (Intr) sp(W)D1(0) sp(W)C(10).1 txB s(W)D1(0): sp(Weeks)D1(0) -0.371 sp(Weeks)C(10).1 0.256 -0.604 txB -0.707 0.262 -0.181 sp(Weeks)D1(0):txB 0.262 -0.707 0.427 -0.371 sp(Weeks)C(10).1:txB -0.181 0.427 -0.707 0.256 -0.604 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -4.109811205 -0.593593851 -0.002546668 0.654503092 3.122385555 Number of Observations: 1600 Number of Groups: 80

- Interpret the coefficients in the model.
- Sketch the predicted trajectories.
- Bonus: How would you test whether there is a significant difference in the predicted symptom score at week 10 or week 18?

## Georges' Questions

### Interpreting p-values

Consider a regression of a continuous variable Y on a continuous variable X and a dichotomous factor coded with an indicator variable G. Consider a regression of Y on X and G with:

In the multiple regression of Y on X and G neither nor are significant. However the F-test for the hypothesis that both parameters are 0 yields a p-value of 0.002.

Sketch a plausible data set that could exhibit this phenomenon in data space with axes for Y and X and group membership indicated by different characters. Also sketch relevant confidence ellipses in β_{X},β_{G} space.

### Multilevel models

Consider a multilevel random slopes model of the form:

with , independent of , ; independent for .

Let .

In the following questions, treat the macro level parameters and as they were fixed and known.

- Give an expression for the BLUE of .
- Give an expression for the BLUP of as a function of the BLUE and other non-random quantities.
- Describe how the BLUP is a shrinkage estimator based on the BLUE.
- For large and relatively fixed variances for the values of X within each cluster, how will the BLUP behave relative to the BLUE?
- What are the implications for the BLUP if is highly concentrated?

### Interpreting a factorization of G

Consider a random coefficient model with a random intercept and random slope. Let the G matrix have the decomposition where

Show that *a*_{0} is the minimal standard deviation of random regression lines above and below the population regression line.

### Intrepreting output

The following questions refer to the output below for a mixed model for the full high school math achievement data set. The model uses SES, SES.School which is the mean SES in the sample in each school, ‘female’ which is an individual level indicator variable and ‘Type’ which is three-level factor with levels “Coed”, “Girl” and “Boy” with the obvious definition and Sector which is a 2-level factor with levels “Catholic” and “Public”.

- Consider two Catholic ‘girl’ schools, one with mean SES = 0 and the other with mean SES = 1. Suppose the values of SES in the former school range from -1 to 1 and in the latter school from 0 to 2. Draw a graph showing the predicted MathAch in these two schools over the range of values of SES in each school. On your graph identify the value and location of the contextual effect of SES, the within school effect of SES and the compositional effect of SES.
- Suppose you were to refit the model without SES.School. What would you expect to happen to the coefficient for SES? Would it stay roughly the same, get bigger or get smaller, or is the change unpredictable? Explain.
- Suppose you want to perform an overall test of the importance of gender in the model, either within schools or between schools. Specify a hypothesis matrix that would perform this test.
- Estimate the difference between the predicted math achievement of a boy in a boys’ school versus a girl in a girls’ school. If you suspected that this is affected by the SES of the school, how would you modify the model to test this hypothesis?

Media:MATH_6643_Sample_exam_output_2.pdf

### Testing identifiability of the G and R models

Consider a mixed model for data with a response variable Y and a single predictor X. Suppose that each cluster has size 2 and X is measured at the values 0 and 1. Is it possible to identify the parameters of a random slope model? What if each cluster had size 3 and X were observed at levels -1, 0 and +1?