1. Notes

This document is for discussion and planning of standard versus mixed effects modeling (alt. multilevel modeling) approaches for the analyses of data from the Task Switching - Tasking Maintaining project (Traut et al., in prep).

In it’s most basic terms, the TSTM paradigm presented participants with a series of trials differing in Strategy condition (Switching vs. Maintaining) and Cue condition (Cued vs. Uncued) - comprising a 2x2 within subjects design. On each trial, participants either successfully adhered to the correct strategy or they did not. Participants were from one of three age groups (7yo, 10yo, Adults).

The purpose of this document is determine what modeling approaches are most appropriate given the principle questions of the study:

  • Are there differences in adaptive coordination of switching and maintaining strategies across developmental groups?
    • Hypothesis: Yes, there is a linear growth associated with adaptive coordination of strategies across developmental groups.
  • Are there differences in the use of cues to support adaptive coordination of switching and maintaining strategies across developmental groups?
    • Hypothesis: Yes, there is an inverted U association with the effect of cue availability on coordination of strategies across developmental groups, such that young children only minorly benefit from cues, older children significantly benefit from cues, and adults do not benefit from cues (but display greater strategy adherence that the other two groups).
  • How do individual differences in baseline switching abilities and processing speed relate to adaptive coordination of switching and maintaining strategy performance?
    • Hypothesis: Measures of Switching ability (DCCS task) will be associated with adherence to strategy performance on TSTM - this will be particularly strong for young children.

Additional questions for this study include:

  • Is there an effect of strategy condition on strategy adherence? Is it easier to adhere to one strategy or the other? Does this change across development?
  • Does one strategy ‘benefit’ more from the presence of cue in terms of likelihood of strategy adherence?
  • Do age groups differ in the rate of their adaptation to the appropriate strategy across trials?

The models presented in these notes are for the simplest of these question first.

2. Outcome Measure

Our outcome measure of interest, adaptive coordination of switching and maintaining strategies, will be codified as the likelihood of strategy adherence on a given trial. This is derived from binary coding of strategy adherence on a given trial (1/0) and will be calculated from the Log Odds outcome of the base logistic regressions proposed below.

3. Standard Regression

The use of a standard logistic regression approach analyzes the data based on the outcome of each individual trial collapsing across participants.

3.1 Model Structure

The base structure of the standard regression model is as follows:

\[LogOddsStrategyAdherence = \beta_{0}+\beta_{1}(Trial) +\beta_{2}(Strategy)+\beta_{3}(Cue)+\beta_{4}(Age)+ \\ \beta_{5}(Trial*Strategy)+\beta_{6}(Trial*Cue)+\beta_{7}(Trial*Age)+ \\ \beta_{8}(Strategy*Cue) + \beta_{9}(Stategy*Age) + \beta_{10}(Cue*Age) \\ \beta_{11}(Trial*Strategy*Cue) + \beta_{12}(Trial*Strategy*Age) + \\ \beta_{13}(Trial*Cue*Age) + \beta_{14}(Strategy*Cue*Age) + \\ \beta_{15}(Trial*Strateg*Cue*Age)\]

3.2 Interpretation of Terms

Each term within the model assesses the following. Bolded terms are critical to questions of interest.

  • \(\beta_0\) = the average log odds of strategy adherence across trials across participants (i.e. intercept).
  • \(\beta_1\) = marginal effect on log odds of strategy adherence given Trial (continuous variable 1-8).
  • \(\beta_2\) = marginal effect on log odds of strategy adherence based on Switching and Maintaining trial conditions.
    • To be contrast coded (-0.5, 0.5).
  • \(\beta_3\) = marginal effect on log odds of strategy adherence based on Cued and Uncued trial conditions.
    • To be contrast coded (-0.5, 0.5).
  • \(\beta_4\) = marginal effect on log odds of strategy adherence of Age Group of participant completing trial.
    • Contrast coding TBD.
    • Note: Age Group consists of three levels, tf. multiple coefficients will be necessary to capture predictor.
  • \(\beta_5\) = marginal effect on log odds of strategy adherence of Trial given Strategy condition.
  • \(\beta_6\) = marginal effect on log odds of strategy adherence of Trial given Cue condition.
  • \(\beta_7\) = marginal effect on log odds of strategy adherence of Trial given Age Group.
  • \(\beta_8\) = marginal effect on log odds of strategy adherence of Strategy condition given Cue condition
  • \(\beta_9\) = marginal effect on log odds of strategy adherence of Strategy condition given Age Group
  • \(\beta_{10}\) = marginal effect on log odds of strategy adherence of Cue condition given Age Group
  • \(\beta_{11}\) = marginal effect on log odds of strategy adherence of Trial given Strategy condition given Cue Condition
  • \(\beta_{12}\) = marginal effect on log odds of strategy adherence of Trial given Strategy condition given Age Group
  • \(\beta_{13}\) = marginal effect on log odds of strategy adherence of Trial given Cue condition given Age Group
  • \(\beta_{14}\) = marginal effect on log odds of strategy adherence of Strategy condition given Cue condition given Age Group
  • \(\beta_{15}\) = marginal effect on log odds of strategy adherence of Trial given Strategy condition given Cue condition given Age Group

3.3 Model Syntax

In terms of implementation using the glm function from base R, the formula would be:

glm(log ~ trial*strategy*cue*age_grp, data = tstm_measures, family = binomial(link = "logit"))

3.4 Pros & Cons

The advantage of the standard logistic regression approach is that it is the simplest sufficient method of assessing our pertinent questions as well as the most readily interpreted approach.

The disadvantage is that it ignores the dependence of trials within participant and the structural association of Age Group to participant level as opposed to trial level.

4. Mixed Effects

The use of a mixed effects modeling approach assumes two levels of analysis for the data:

  • Level 1: Trial level \(i\)
  • Level 2: Participant level \(j\)

As with the standard approach, the ultimate outcome at Level 1 is the likelihood of strategy adherence on a given trial as gauged by a 1/0 binary from the recorded data.

The model will include a random intercept, allowing estimation of average performance to differ between individual participants. The model does not currently include random slopes.

4.1 Model Structure

Level one model (trial level) for this approach is be:

\[LogOddsStrategyAdherence_{ij} = \beta_{0j} + \beta_{1j}(Trial)_{ij} + \beta_{2j}(Strategy)_{ij} + \beta_{3j}(Cue)_{ij}+ \\ \beta_{4j}(Trial*Strategy)_{ij}+\beta_{5j}(Trial*Cue)_{ij}+\beta_{6j}(Strategy*Cue)_{ij} +\\ \beta_{7j}(Trial*Strategy*Cue)_{ij}\]

Where the sampling function is \(Y_{ij}|\varphi_{ij} \sim Bernoulli(\varphi_{ij})\), with a probability mass function for the Bernoulli distribution being: \[P(y;\mu) = \binom{n}{yn}\mu^{yn}(1-\mu)^{(1-y)n}\]

Level two models (participant level) for this approach is:

\[\beta_{0j} = \gamma_{00} + \gamma_{01}(Age_j) + u_{0j} \] \[\beta_{1j} = \gamma_{10} + \gamma_{11}(Age_j)\] \[\beta_{2j} = \gamma_{20} + \gamma_{21}(Age_j)\] \[\beta_{3j} = \gamma_{30} + \gamma_{31}(Age_j)\] \[\beta_{4j} = \gamma_{40} + \gamma_{41}(Age_j)\] \[\beta_{5j} = \gamma_{50} + \gamma_{51}(Age_j)\] \[\beta_{6j} = \gamma_{60} + \gamma_{61}(Age_j)\]

Where \(u_{nj}\) ~ independent, \(N(0,\tau_{n0})\)

For a complete mixed model of:

\[LiklihoodStrategyAdherence_{ij} = \\ \gamma_{00} + \gamma_{01}(Age_j) + \gamma_{10} + \gamma_{11}(Age_j) + \\ \gamma_{20} + \gamma_{21}(Age_j) + \gamma_{30} + \gamma_{31}(Age_j) + \\ \gamma_{40} + \gamma_{41}(Age_j) + \gamma_{50} + \gamma_{51}(Age_j) + \\ \gamma_{60} + \gamma_{61}(Age_j) + u_{0j}\]

4.2 Interpretation of Terms

Level 1 terms:

  • \(\beta_{0j}\) = intercept of log odds of strategy adherence for each participant \(j\).
  • \(\beta_{1j}\) = marginal effect on log odds of strategy adherence for a trial based on Switching versus Maintaining trial conditions.
    • To be contrast coded (-0.5, 0.5).
  • \(\beta_{2j}\) = marginal effect on log odds of strategy adherence based on Uncued versus Cued trial conditions.
    • To be contrast coded (-0.5, 0.5).
  • \(\beta_{3j}\) = marginal effect on log odds of strategy adherence based on Strategy condition given Cue condition.
  • \(\varphi_{ij}\) = ???

Level 2 terms:

  • \(\gamma_{00}\) = intercept of log odds of strategy adherence across participants.
  • \(\gamma_{01}\) = marginal effect of Age Group on participants’ log odds of strategy adherence.
  • \(u_{0j}\) = residual error in intercept for participant \(j\).
  • \(\tau_{00}\) = residual variance for each participant \(j\) controlling for age.

  • \(\gamma_{10}\) = average marginal effect of trial number across participants.
  • \(\gamma_{11}\) = marginal effect of participant Age Group on the Slope of trial number.

  • \(\gamma_{20}\) = average marginal effect of trial Strategy condition across participants.
  • \(\gamma_{21}\) = marginal effect of participant Age Group on the Slope of trial Strategy condition.

  • \(\gamma_{30}\) = average marginal effect of trial Cue condition across participants.
  • \(\gamma_{31}\) = marginal effect of participant Age Group on the slope of trial Cue condition.

  • \(\gamma_{40}\) = average marginal effect of trial Trial*Strategy condition across participants.
  • \(\gamma_{41}\) = marginal effect of participant Age Group on the slope of trial Trial*Strategy condition.

  • \(\gamma_{50}\) = average marginal effect of trial Trial*Cue condition across participants.
  • \(\gamma_{51}\) = marginal effect of participant Age Group on the slope of trial Trial * Cue condition.

  • \(\gamma_{60}\) = average marginal effect of trial Strategy*Cue condition across participants.
  • \(\gamma_{61}\) = marginal effect of participant Age Group on the slope of trial Strategy*Cue condition.

  • \(\gamma_{60}\) = average marginal effect of trial Trial * Strategy * Cue condition across participants.
  • \(\gamma_{61}\) = marginal effect of participant Age Group on the slope of trial Trial * Strategy * Cue condition.

4.3 Model Syntax

Mixed effects logistic regression can be implemented using the glmer function from the lme4 package.

lme4::glmer(log ~ trial*strategy*cue + (1|partID + age), data = tstm_measures, 
            family = binomial(link = "logit"))

4.4 Pros & Cons

The advantage of the MEM approach is that it (a) allows us to account of the dependence of trials within participant, (b) it allows us to parcel out variance for item-level characteristics (e.g. trial condition) versus participant-level characteristics, and (c) provides a potential more nuanced evaluation of the interplay of predictors in our dataset.

The disadvantage of the MEM approach is it’s complexity in terms of implementation - and the resulting complexity in terms of interpreting results, particularly withing a logistic framework (which is already rather difficult to translate into real world terms).

5. Questions

  • Is the model syntax for including the level 2 slope for Age group correct? Haven’t found a specific sample addressing this type of model structure.

  • What exactly is \(\varphi\) in the sampling function?

  • What is the distribution of error parameters for both the standard and mixed effects logistic regressions?

  • What value might including random slopes in the mixed effects approach provide for answering our questions? Do we loose anything with regard to interpreting the Age parameters at Level 2 by not including random slopes?

  • How should ease of comprehension between these two models inform our decision about which approach to use?

  • What contrast code is most appropriate for the Age Group predictor given the hypothesized linear progression in the development of adaptive coordination for strategy?