distributed practice
play

Distributed Practice! Louis is a positive psychologist interested in - PowerPoint PPT Presentation

Distributed Practice! Louis is a positive psychologist interested in peoples subjective feeling of well-being (SWB). He interviews 200 people in each of 50 countries about their SWB as well as other characteristics of their life. Louis


  1. Distributed Practice! � Louis is a positive psychologist interested in peoples’ subjective feeling of well-being (SWB). He interviews 200 people in each of 50 countries about their SWB as well as other characteristics of their life. Louis runs the following model to relate SWB to the number of close friends people have: model1 <- lmer(SWB ~ 1 + NumFriends + (1|Country), data=swb) However, Louis realizes that the relationship between social support might vary across countries—e.g., in more collectivistic vs. more individualistic societies. Create a model2 that allows the relationship between NumFriends and SWB to vary across countries.

  2. Distributed Practice! � Louis is a positive psychologist interested in peoples’ subjective feeling of well-being (SWB). He interviews 200 people in each of 50 countries about their SWB as well as other characteristics of their life. Louis runs the following model to relate SWB to the number of close friends people have: model1 <- lmer(SWB ~ 1 + NumFriends + (1|Country), data=swb) However, Louis realizes that the relationship between social support might vary across countries—e.g., in more collectivistic vs. more individualistic societies. Create a model2 that allows the relationship between NumFriends and SWB to vary across countries. � model2 <- lmer(SWB ~ 1 + NumFriends + (1+NumFriends|Country), data=swb) Tip: Can read | as “within each”. We want a separate intercept ( 1 ) and NumFriends effect within each country.

  3. Course Business � Midterm assignment: Review a journal article in your area that uses mixed-effects models � Goals: � Practice interpreting mixed-effects models � Springboard for class discussion of current practice & reporting � See CourseWeb document for specific requirements � Due on CourseWeb on March 1 st at 2:00 PM– 3 weeks from today � Grading rubric on CourseWeb

  4. Course Business � Midterm assignment: Review a journal article in your area that uses mixed-effects models � Requirements on the chosen article: � Journal article, not poster / conference proceedings � Should have at least one random effect—that makes it a mixed-effects model � Any type of random effects structure OK (nested or crossed) � Random effect(s) can be anything—classrooms, schools, subjects, items, families, … � Can run the article by me if unsure

  5. Week 6: Coding Predictors I � Finish Random Effects � Convergence Failures � BLUPs � Centering Continuous Variables � Introduction to Contrast Coding � Dummy Coding � What it Means � How to Change Codes � Interactions � Effects Coding � Main Effects vs Simple Main Effects � Unbalanced Factors

  6. Failures to Converge • Last week: Emergent standard for experimental designs is to at least consider the maximal random effects structure • All possible random slopes • Not doing this ≈ Having a repeated-measures design, but not running repeated-measures ANOVA • But, sometimes a model with complex random effects structure will “fail to converge” or hit “false convergence”

  7. Failures to Converge: Solutions • Some solutions we already saw last week: • Make R try longer to fit the model: model3 <- lmer(RT ~ 
 • 1 + YearsOfStudy * WordFreq + 
 (1 + WordFreq|Subject) + 
 (1 + YearsOfStudy|Item), data=naming, 
 control=lmerControl(optCtrl=list(maxfun=20000))) • Not always a great solution • Remove correlation parameters • Often not of interest, and don’t affect the tests we are interested in • Use || model.NoCorr <- lmer(RT ~ YearsOfStudy * WordFreq + • (1+WordFreq|Subject) + (1+YearsOfStudy||Item), data=naming) • Near-maximal random effects structure

  8. Failures to Converge: Solutions • Also possible to test whether random slopes matter and only includes ones that matter • Issue of shrinkage comes back—we’re now using the same data to (a) decide the model and (b) evaluate particular effects in the model • Guidelines (Barr et al., 2013; Matuschek et al., 2015) : • Retain random slopes for the effects we want to test • We don’t want to exclude something that matters, so use a liberal criterion for including random effects (e.g., p < .20) • In experimental contexts: Items typically vary less than subjects, so first test whether item slopes contribute over random-intercepts model. Don’t include if non-significant.

  9. Failures to Converge: Solutions • Collect more data! • Failure to converge can simply be a sign that we are asking too much of a small dataset • Just because we want the data to be able to answer this question doesn’t mean it can

  10. Failures to Converge Due to Scaling model.PrevTrialRT <- lmer(RT ~ YearsOfStudy * • WordFreq * PrevTrialRT + (1 + WordFreq|Subject) + (1+YearsOfStudy|Item), data=naming) • Algorithm doesn’t work as well if the variables are on very different scales YearsOfStudy measured in years BIG effect of 1-unit change PrevTrialRT measured in msec TINY effect of 1-unit change • Latter effect basically just gets “rounded out”

  11. Failures to Converge Due to Scaling model.PrevTrialRT <- lmer(RT ~ YearsOfStudy * • WordFreq * PrevTrialRT + (1 + WordFreq|Subject) + (1+YearsOfStudy|Item), data=naming) • Algorithm doesn’t work as well if the variables are on very different scales • Simple solution: Change a variable to be a different scale • e.g., naming$PrevTrialRTInSeconds <- naming$PrevTrialRT / 1000

  12. Week 6: Coding Predictors I � Finish Random Effects � Convergence Failures � BLUPs � Centering Continuous Variables � Introduction to Contrast Coding � Dummy Coding � What it Means � How to Change Codes � Interactions � Effects Coding � Main Effects vs Simple Main Effects � Unbalanced Factors

  13. BLUPs • ranef(model3) • Shows you the intercepts and slopes for individual subjects & items • These are adjustments relative to the model predictions RTs for the word breakfast are, on average, 5.8 ms longer than what we’d predict based on baseline RT and word frequency

  14. BLUPs • ranef(model3) • Shows you the intercepts and slopes for individual subjects & items • B est L inear U nbiased P redictors ( BLUPs ) • Yes, this is a real term! • hist(ranef(model3)$Item[,1]) • Histogram of the item intercepts! • Looks pretty normally distributed … but this could tell us if 1 or 2 items are potential outliers [,2] for slopes •

  15. BLUPs • Why do you think the BLUPs aren’t displayed in our initial results from summary() ? • For random effects, we’re mainly interested in modeling variability • BLUPs aren’t considered parameters of the model • Not what this is a model “of” • We ran this analysis to model the effects of word frequency & study abroad experience, not the word chair • If we ran the same design with a different sample, BLUPs probably wouldn’t be the same • No reason to expect that Subject 23 in the new sample will again be one of the faster subjects • By contrast, we do intend for our fixed effects to replicate

  16. Each of these is a scatterplot Plotting Subject Effects of RT and WordFreq for a different subject—are they consistent across subjects? • library( 
 lattice) • Package should be already installed; don’t need to download first • xyplot(RT ~ WordFreq| Subject, data=naming)

  17. The View Ahead • We’ve covered the basics of fitting a mixed effects model • But only with continuous variables • Next 3 weeks: Categorical variables (factors) • Next two weeks: Categorical predictors (IVs) • e.g., experimental vs. control condition; race/ethnicity • After that: Categorical outcomes (DVs) • e.g., recalled vs. didn’t recall a science fact; did or didn’t graduate high school

  18. Week 6: Coding Predictors I � Finish Random Effects � Convergence Failures � BLUPs � Centering Continuous Variables � Introduction to Contrast Coding � Dummy Coding � What it Means � How to Change Codes � Interactions � Effects Coding � Main Effects vs Simple Main Effects � Unbalanced Factors

  19. The Big Picture � Choices about how to code variables (esp. categorical ones) � Allow us to answer different questions about the data � In most cases, multiple statistically valid ways to code � But, important that we actually perform the test that corresponds to what we say we want to know

  20. Week 6 Sample Data: aphasia.csv � Task: Decide whether a picture matches a sentence; measure RT

  21. Week 6 Sample Data: aphasia.csv � Task: Decide whether a picture matches a sentence; measure RT “The dog was chased by the man.”

  22. Week 6 Sample Data: aphasia.csv � Task: Decide whether a picture matches a sentence; measure RT � Each Item : Unique sentence w/ a unique picture � No picture or sentence repeats “The dog was chased “The bee stung the man.” by the man.”

  23. Week 6 Sample Data: aphasia.csv � Task: Decide whether a picture matches a sentence; measure RT � Each Item : Unique sentence w/ a unique picture � 16 people with aphasia and 16 healthy controls ( SubjectType ) � All participants see the same sentences, which vary in SentenceLength (in words) and SentenceType (Active or Passive) � Active (more common): “Man bites dog.” � Passive: “The dog was bitten by the man.” � Which variable(s) are between-subjects? � Which variable(s) are within-subjects? � Hint: Imagine we had only 1 subject. If we could still test the effect of a variable, it’s within-subjects.

Recommend


More recommend