Mixed Effects Models - Growth Curve Analysis

Course Business
! Lab materials on Canvas
! Final project information will be posted on
Canvas at 4:00 PM today
• Final project: Analyze your own data
• I can supply simulated data if needed—send me an intro
& methods section for the data you’d like to analyze
• In-class presentation: Last 2.5 weeks of class,
beginning Nov. 9th
• Sign up on Canvas for a time slot – first come, first
served!
• Final paper: Due on Canvas last day of class
• Canvas will have more info. on requirements
Week 11.1: Growth Curve Analysis
! Overview
! Reshaping Data
! Growth Curve Analysis
! Time as a Predictor Variable
! Quadratic & Higher Degrees
! Random Slopes
! Time-Variant & -Invariant Variables
! Breakpoints
! Lab
Longitudinal Designs
Time
Longitudinal Designs
• There are many methods available for
analyzing longitudinal data
• Aidan Wright’s class on Applied Longitudinal Data
Analysis
• Mixed-effects models are one effective
solution
• Hierarchical models naturally account for
longitudinal data
• Include all of the other features we’ve looked at
(multiple random effects, mix of categorical &
continuous variables, non-normal DVs, etc.)
School
1
School
2
Student
2
Student
1
Student
3
Student
4
Sampled SCHOOLS
Sampled STUDENTS
LEVEL 2
LEVEL 1
• What kind of random-effects structure is this?
Longitudinal Data as Hierarchical Data
School
1
School
2
Student
2
Student
1
Student
3
Student
4
Sampled SCHOOLS
Sampled STUDENTS
LEVEL 2
LEVEL 1
• What kind of random-effects structure is this?
• Two levels of nesting – sample schools, then
sample students inside each school
Longitudinal Data as Hierarchical Data
Student
1
Exam 1
Student
2
Exam 2
Student
3
Exam 1
Student
3
Exam 2
• Now imagine we observed each student several
different times
• e.g., midterm & final exam
School
1
School
2
Student
2
Student
1
Student
3
Student
4
Sampled SCHOOLS
Sampled STUDENTS
LEVEL 2
LEVEL 1
Longitudinal Data as Hierarchical Data
Student
1
Exam 1
Student
2
Exam 2
Student
3
Exam 1
Student
3
Exam 2
School
1
School
2
Student
2
Student
1
Student
3
Student
4
Sampled SCHOOLS
Sampled STUDENTS
LEVEL 3
LEVEL 2
• This is just another level of nesting
• Sample schools
• Sample student within each school
• Sample time points within each student
Longitudinal Data as Hierarchical Data
Sampled
TIME POINTS
LEVEL 1
Longitudinal Designs
• Two big questions mixed-effects models can
help us answer about longitudinal data:
1) What is the overall trajectory of change
across time?
" Today
2) How does an observation at one time point
relate to the next time point?
" Wednesday
vocab.csv
! Role of language input in early
vocab acquisition
! 200 kids from lower SES families:
! 100 families given books to read
to their kids
! 100 waitlisted controls
! Vocab assessed every 2 months
from 20 mos. to 28 mos.
! Research questions:
! What is the general trajectory of
vocabulary acquisition in these ages?
! How is this altered by our intervention?
Week 11.1: Growth Curve Analysis
! Overview
! Reshaping Data
! Growth Curve Analysis
! Time as a Predictor Variable
! Quadratic & Higher Degrees
! Random Slopes
! Time-Variant & -Invariant Variables
! Breakpoints
! Lab
Long vs. Wide Format
! For lmer(), each observation
needs its own row
! “long” format
Time 1 row
Time 2 gets a separate row
One trial
Another trial
Long vs. Wide Format
! For lmer(), each observation
needs its own row
! “long” format
! Sometimes data comes to
us in “wide” format
! Each repeated measure
is a different column
in the same row
! e.g., what
SPSS uses
! vocab.csv is
in this format
Time 1 and Time 2 are considered
separate variables
Time 1 row
Time 2 gets a separate row
Long vs. Wide Format
! Tidyverse contains very easy functions for
pivoting data between formats
! pivot_longer(): To turn data into long format
! pivot_wider(): To turn data into wide format
pivot_longer()
! Here is a look at our dataframe…
We want to turn into
each of these
columns into a
separate row
pivot_longer()
! vocab %>%
pivot_longer(cols=c('Month0','Month2','Month4’,
'Month6','Month8')) -> vocab.p
! Now we have five rows per child
We want to turn into
each of these
columns into a
separate row
pivot_longer()
! By default, R saves the original column name in a
variable called “name”, and the DV in a variable called
“value”
! Not very informative
! We can specify better names :
! vocab %>%
pivot_longer(cols=c('Month0','Month2','Month4’,
'Month6','Month8’), names_to='MonthsInStudy’,
values_to='VocabWords') -> vocab.p
pivot_longer()
! By default, R saves the original column name in a
variable called “name”, and the DV in a variable called
“value”
! Not very informative
! We can specify better names :
! vocab %>%
pivot_longer(cols=c('Month0','Month2','Month4’,
'Month6','Month8’), names_to='MonthsInStudy’,
values_to='VocabWords') -> vocab.p
pivot_longer()
! What we’d really like is to turn MonthsIntoStudy into a
numeric variable
! Currently, the values are “Month0,” “Month2,” etc., because
those were the original column names
! Since these all start with the same prefix (Month), tidyverse
can automatically strip that out for us
! vocab %>%
pivot_longer(cols=c('Month0','Month2','Month4','
Month6','Month8’), names_to='MonthsInStudy',
names_prefix='Month', values_to='VocabWords')->
vocab.p
pivot_longer()
! What we’d really like is to turn MonthsIntoStudy into a
numeric variable
! Currently, the values are “Month0,” “Month2,” etc., because
those were the original column names
! Since these all start with the same prefix (Month), tidyverse
can automatically strip that out for us
! vocab %>%
pivot_longer(cols=c('Month0','Month2','Month4','
Month6','Month8’), names_to='MonthsInStudy',
names_prefix='Month', values_to='VocabWords')->
vocab.p
pivot_longer()
! Now, we can use as.numeric() on this variable
! vocab.p %>%
mutate(MonthsInStudy=as.numeric(MonthsInStudy))
-> vocab.p
pivot_longer()
! Now, we can use as.numeric() on this variable
! vocab.p %>%
mutate(MonthsInStudy=as.numeric(MonthsInStudy))
-> vocab.p
Week 11.1: Growth Curve Analysis
! Overview
! Reshaping Data
! Growth Curve Analysis
! Time as a Predictor Variable
! Quadratic & Higher Degrees
! Random Slopes
! Time-Variant & -Invariant Variables
! Breakpoints
! Lab
vocab.csv
! Role of language input in early
vocab acquisition
! 200 kids from lower SES families:
! 100 families given books to read
to their kids
! 100 waitlisted controls
! Vocab assessed every 2 months
from 20 mos. to 28 mos.
! Research questions:
! What is the general trajectory of
vocabulary acquisition in these ages?
! How is this altered by our intervention?
Longitudinal Designs
• Two big questions mixed-effects models can
help us answer about longitudinal data:
1) What is the overall trajectory of change
across time?
" Today: Growth curve analysis
2) How does an observation at one time point
relate to the next time point?
" Wednesday
Time as a Predictor Variable
• How does vocabulary change over time?
• The simple way to answer this question: Add
time as a variable in our model
• Nothing “special” about time as a predictor
Time as a Predictor Variable
• Let’s add the effect of time to our model
• Here: MonthsInStudy (starting at 0)
• Fixed effect because we’re interested in time effects
• model1 <- lmer(VocabWords ~ 1 + MonthsInStudy +
(1|Child), data=vocab)
• How would you interpret the two estimates?
• Intercept:
• Slope:
Time as a Predictor Variable
• Let’s add the effect of time to our model
• Here: MonthsInStudy (starting at 0)
• Fixed effect because we’re interested in time effects
• model1 <- lmer(VocabWords ~ 1 + MonthsInStudy +
(1|Child), data=vocab)
• How would you interpret the two estimates?
• Intercept: Average vocab ~51 words at start of study
• Slope: Gain of about ~35 words per month
Time as a Predictor Variable
• Not necessary to have every time point
represented
• Don’t even have to be
the same set of time
points across
participants
• Time units also don’t matter as long as they’re
consistent
• Could be hours, days, years …
Week 11.1: Growth Curve Analysis
! Overview
! Reshaping Data
! Growth Curve Analysis
! Time as a Predictor Variable
! Quadratic & Higher Degrees
! Random Slopes
! Time-Variant & -Invariant Variables
! Breakpoints
! Lab
Quadratic & Higher Degrees
Quadratic & Higher Degrees
• We’ve been assuming a linear effect of time
Quadratic & Higher Degrees
• But, it looks like vocab growth may accelerate
• Growth between 0 mo. and 2 mo. is much smaller
than growth between 6 mo. and 8 mo.
• Suggests a curve / quadratic equation
Quadratic & Higher Degrees
• Add quadratic effect (MonthsInStudy2):
• model.poly <- lmer(VocabWords ~ 1 +
poly(MonthsInStudy,degree=2,raw=TRUE) +
(1|Child), data=vocab.p)
• degree=2 because we want MonthsInStudy2
• poly() automatically adds lower-order terms as
well
• i.e., the linear term (MonthsInStudy1)
• raw=TRUE to keep the original scale of the
variables (time measured in months)
Quadratic & Higher Degrees
• Results:
• Implied equation (approximate):
• VocabWords = 75 + 11*Months + 3*Months2
• What are predicted values if…
• Month=0?
• Month=1?
• Month=2?
Intercept
Linear term
Quadratic term
Quadratic & Higher Degrees
• Results:
• Implied equation (approximate):
• VocabWords = 75 + 11*Months + 3*Months2
• What are predicted values if…
• Month=0?
• Month=1?
• Month=2?
• Vocab growth is accelerating (larger change from
month 1 to month 2 than from month 0 to month 1)
Intercept
Linear term
Quadratic term
VocabWords=75+(11*0)+(3*02) = 75
VocabWords=75+(11*1)+(3*12) = 89
VocabWords=75+(11*2)+(3*22) = 109 +20
+14
POSITIVE
QUADRATIC TREND
& NO LINEAR
TREND
NEGATIVE
QUADRATIC TREND
& NO LINEAR
TREND
POSITIVE
QUADRATIC TREND
& POSITIVE LINEAR
TREND
NEGATIVE
QUADRATIC TREND
& POSITIVE LINEAR
TREND
Different patterns of quadratic & linear effects in
a GCA describe different curves
POSITIVE
QUADRATIC TREND
& NO LINEAR
TREND
NEGATIVE
QUADRATIC TREND
& NO LINEAR
TREND
POSITIVE
QUADRATIC TREND
& POSITIVE LINEAR
TREND
NEGATIVE
QUADRATIC TREND
& POSITIVE LINEAR
TREND
• Linear trend: Is there an overall increase over time (+),
decrease (-), or no change?
• Quadratic trend: Is the line curved up (+), down (-), or straight?
Quadratic & Higher Degrees
• The Yerkes-Dodson law (Yerkes & Dodson, 1908)
describes the optimal level of physiological arousal to
perform a task: Low arousal results in poor
performance because you are not alert enough,
medium arousal results in strong performance, and
high arousal results in poor performance because
you are too anxious.
Linear trend:
Quadratic trend:
Quadratic & Higher Degrees
• The Yerkes-Dodson law (Yerkes & Dodson, 1908)
describes the optimal level of physiological arousal to
perform a task: Low arousal results in poor
performance because you are not alert enough,
medium arousal results in strong performance, and
high arousal results in poor performance because
you are too anxious.
Linear trend:
Quadratic trend:
NONE
NEGATIVE
Quadratic & Higher Degrees
• In adulthood, working memory declines the
older you get (Park et al., 2002).
Linear trend:
Quadratic trend:
Quadratic & Higher Degrees
• In adulthood, working memory declines the
older you get (Park et al., 2002).
Linear trend:
Quadratic trend: NONE
NEGATIVE
Quadratic & Higher Degrees
• Aphasia is a neuropsychological disorder that
disrupts speech, often resulting from a stroke. After
initially acquiring aphasia, patients often experience
rapid recovery in much of their language
performance (dependent variable) as time
(independent variable) increases. But, this recovery
eventually slows down, and language performance
doesn’t get much better no matter how much more
time increases (e.g., Demeurisse et al., 1980).
Linear trend:
Quadratic trend:
Quadratic & Higher Degrees
• Aphasia is a neuropsychological disorder that
disrupts speech, often resulting from a stroke. After
initially acquiring aphasia, patients often experience
rapid recovery in much of their language
performance (dependent variable) as time
(independent variable) increases. But, this recovery
eventually slows down, and language performance
doesn’t get much better no matter how much more
time increases (e.g., Demeurisse et al., 1980).
Linear trend:
Quadratic trend:
POSITIVE
NEGATIVE
Quadratic & Higher Degrees
• Studies of practice and expertise (e.g., Logan, 1988)
show that people learning to do a task—such as
arithmetic—initially show a quick decrease in
response time (dependent variable) as the amount of
practice increases. However, eventually they hit the
point where the task can’t possibly be done any
faster, and response time reaches an asymptote and
stops decreasing.
Linear trend:
Quadratic trend:
Quadratic & Higher Degrees
• Studies of practice and expertise (e.g., Logan, 1988)
show that people learning to do a task—such as
arithmetic—initially show a quick decrease in
response time (dependent variable) as the amount of
practice increases. However, eventually they hit the
point where the task can’t possibly be done any
faster, and response time reaches an asymptote and
stops decreasing.
Linear trend:
Quadratic trend:
NEGATIVE
POSITIVE
Quadratic & Higher Degrees
• Could go up to even higher degrees (Time3,
Time4…)
• degree=3 if highest exponent is 3
• Degree minus 1 = Number of bends in the
curve
-100 -50 0 50 100
x^3
0 20 40 60 80 100
x^1
0 20 40 60 80 100
x^2
0 bends
1 bend
2 bends
Quadratic & Higher Degrees
• Maximum degree of polynomial: # of
time points minus 1
• Example: 2 time points perfectly fit by
a line (degree 1). Nothing left for
a quadratic term to explain.
• But, don’t want to overfit
• Probably not the case that the real underlying
(population) trajectory has 6 bends in it
• What degree should we include?
• Theoretical considerations
• If comparing conditions, look at mean
trajectory across conditions (Mirman et al., 2008)
Week 11.1: Growth Curve Analysis
! Overview
! Reshaping Data
! Growth Curve Analysis
! Time as a Predictor Variable
! Quadratic & Higher Degrees
! Random Slopes
! Time-Variant & -Invariant Variables
! Breakpoints
! Lab
Child
2
Child
1
Child
3
Child
4
Child 1
Assess-
ment 1
Child 2
Assess-
ment 2
Child 3
Assess-
ment 1
Child 3
Assess-
ment 2
Sampled CHILDREN
Sampled TIME
POINTS
LEVEL 2
LEVEL 1
• So far, we assume the same growth rate for all kids
• Almost certainly not true!
• At level 2, we’re sampling kids both with different
starting points (intercepts) and growth rates
(slopes)
Longitudinal Data: Random Slopes
Growth
Rate 1 Growth
Rate 2
Longitudinal Data: Random Slopes
RANDOM INTERCEPTS MODEL
Kids vary in starting point, but all
acquire vocabulary at the same rate
over this period
WITH RANDOM SLOPES
Allows rate of vocab acquisition to vary
across kids (as well as intercept)
• Let’s allow the MonthsInStudy effect to be different for
each Child
• model.Slope <- lmer(VocabWords ~ 1 +
poly(MonthsInStudy,degree=2,raw=TRUE) +
(1 + poly(MonthsInStudy,degree=2,raw=TRUE)|Child),
data=vocab.p)
Longitudinal Data: Random Slopes
Child
2
Child
1
Child
3
Child
4
Child 1
Assess-
ment 1
Child 2
Assess-
ment 2
Child 3
Assess-
ment 1
Child 3
Assess-
ment 2
Sampled CHILDREN
Sampled TIME
POINTS
LEVEL 2
LEVEL 1
Growth
Rate 1 Growth
Rate 2
Longitudinal Data: Random Slopes
Substantial variability in the MonthsInStudy slope
SD of the slope across children is ~5 words
Mean slope is 11 words/mo, but some kids might have a slope
of 6 or 16
Week 11.1: Growth Curve Analysis
! Overview
! Reshaping Data
! Growth Curve Analysis
! Time as a Predictor Variable
! Quadratic & Higher Degrees
! Random Slopes
! Time-Variant & -Invariant Variables
! Breakpoints
! Lab
Time-Variant & -Invariant Variables
• We may want to include other
(experimental or observational)
variables in a GCA model:
• e.g., our reading intervention
• MonthsInStudy + Reading
• Effect of Reading invariant across time
• Can only affect the intercept
(parallel lines)
• MonthsInStudy * Reading
• Effect of Reading varies with time
• Can affect intercept & slope
Time-Variant & -Invariant Variables
• Fixed-effect results with the interaction:
e.g., Huttenlocher et al., 1991
Also results in faster vocab growth (amplifies + Time effect)
Linear growth rate for “No” group:
8.4 words / month
Linear growth rate for “Yes” group:
8.4 + 4.7 = 13.1 words / month
Effect of reading at time 0 (intercept): ~6 words
No effect on curvature (quadratic term)
Time-Variant & -Invariant Variables
• Can be either:
• Time-Invariant Predictor:
Same across all time points
within a subject
• e.g., our intervention, race/ethnicity
• Level 2 variables
• Time-Varying Predictor: Varies
even within a subject, from one
time point to another
• e.g., hours of sleep, mood
• Level-1 variable
Child
2
Child
1
Child 1
Assess-
ment 1
Child 2
Assess-
ment 2
Sampled CHILDREN
Sampled TIME
POINTS
LEVEL 2
LEVEL 1
• Since R automatically figures out what’s a level-1
vs. level-2 variable, we don’t have to do anything
special for either kind of variable
Week 11.1: Growth Curve Analysis
! Overview
! Reshaping Data
! Growth Curve Analysis
! Time as a Predictor Variable
! Quadratic & Higher Degrees
! Random Slopes
! Time-Variant & -Invariant Variables
! Breakpoints
! Lab
! Another possibility (in general) is a qualitative
change in the trajectory at some point in the
range of time observed
! e.g., age of majority, public policy changes, etc.
! Include a breakpoint—a categorical variable
that represents whether or not you’re above
the point at which the change happens
! mydata %>%
mutate(Year2015OrLater=
ifelse(Year >= 2015, 1, 0))-> mydata
! New variable is:
! 0 before 2015
! 1 for 2015 onwards
Breakpoints
! Another possibility (in general) is a qualitative
change in the trajectory at some point in the
range of time observed
! e.g., age of majority, public policy changes, etc.
! Include a breakpoint—a categorical variable
that represents whether or not you’re above
the point at which the change happens
Breakpoints
Main effect of breakpoint only – single shift
downward (or upward) but same slope
Main effect of breakpoint & an
interaction – slope also changes
! Can apply this technique to any continuous
variables, not just time
! e.g., above/below the poverty line
! As with higher-order polynomials, be wary of
overfitting the data
! Most effective if we have an a priori reason to
expect a breakpoint somewhere
! Or, use cross-validation to support a more
exploratory analysis
Breakpoints
Week 11.1: Growth Curve Analysis
! Overview
! Reshaping Data
! Growth Curve Analysis
! Time as a Predictor Variable
! Quadratic & Higher Degrees
! Random Slopes
! Time-Variant & -Invariant Variables
! Breakpoints
! Lab
1 of 62

Recommended

Mixed Effects Models - Autocorrelation by
Mixed Effects Models - AutocorrelationMixed Effects Models - Autocorrelation
Mixed Effects Models - AutocorrelationScott Fraundorf
203 views41 slides
Mixed Effects Models - Effect Size by
Mixed Effects Models - Effect SizeMixed Effects Models - Effect Size
Mixed Effects Models - Effect SizeScott Fraundorf
263 views60 slides
Mixed Effects Models - Fixed Effect Interactions by
Mixed Effects Models - Fixed Effect InteractionsMixed Effects Models - Fixed Effect Interactions
Mixed Effects Models - Fixed Effect InteractionsScott Fraundorf
121 views29 slides
Mixed Effects Models - Introduction by
Mixed Effects Models - IntroductionMixed Effects Models - Introduction
Mixed Effects Models - IntroductionScott Fraundorf
202 views57 slides
Mixed Effects Models - Fixed Effects by
Mixed Effects Models - Fixed EffectsMixed Effects Models - Fixed Effects
Mixed Effects Models - Fixed EffectsScott Fraundorf
225 views58 slides
Mixed Effects Models - Random Intercepts by
Mixed Effects Models - Random InterceptsMixed Effects Models - Random Intercepts
Mixed Effects Models - Random InterceptsScott Fraundorf
186 views79 slides

More Related Content

What's hot

Mixed Effects Models - Centering and Transformations by
Mixed Effects Models - Centering and TransformationsMixed Effects Models - Centering and Transformations
Mixed Effects Models - Centering and TransformationsScott Fraundorf
145 views45 slides
Mixed Effects Models - Model Comparison by
Mixed Effects Models - Model ComparisonMixed Effects Models - Model Comparison
Mixed Effects Models - Model ComparisonScott Fraundorf
154 views58 slides
Mixed Effects Models - Post-Hoc Comparisons by
Mixed Effects Models - Post-Hoc ComparisonsMixed Effects Models - Post-Hoc Comparisons
Mixed Effects Models - Post-Hoc ComparisonsScott Fraundorf
683 views33 slides
Mixed Effects Models - Random Slopes by
Mixed Effects Models - Random SlopesMixed Effects Models - Random Slopes
Mixed Effects Models - Random SlopesScott Fraundorf
263 views73 slides
Mixed Effects Models - Simple and Main Effects by
Mixed Effects Models - Simple and Main EffectsMixed Effects Models - Simple and Main Effects
Mixed Effects Models - Simple and Main EffectsScott Fraundorf
628 views90 slides
Mixed Effects Models - Orthogonal Contrasts by
Mixed Effects Models - Orthogonal ContrastsMixed Effects Models - Orthogonal Contrasts
Mixed Effects Models - Orthogonal ContrastsScott Fraundorf
366 views68 slides

What's hot(13)

Mixed Effects Models - Centering and Transformations by Scott Fraundorf
Mixed Effects Models - Centering and TransformationsMixed Effects Models - Centering and Transformations
Mixed Effects Models - Centering and Transformations
Scott Fraundorf145 views
Mixed Effects Models - Model Comparison by Scott Fraundorf
Mixed Effects Models - Model ComparisonMixed Effects Models - Model Comparison
Mixed Effects Models - Model Comparison
Scott Fraundorf154 views
Mixed Effects Models - Post-Hoc Comparisons by Scott Fraundorf
Mixed Effects Models - Post-Hoc ComparisonsMixed Effects Models - Post-Hoc Comparisons
Mixed Effects Models - Post-Hoc Comparisons
Scott Fraundorf683 views
Mixed Effects Models - Random Slopes by Scott Fraundorf
Mixed Effects Models - Random SlopesMixed Effects Models - Random Slopes
Mixed Effects Models - Random Slopes
Scott Fraundorf263 views
Mixed Effects Models - Simple and Main Effects by Scott Fraundorf
Mixed Effects Models - Simple and Main EffectsMixed Effects Models - Simple and Main Effects
Mixed Effects Models - Simple and Main Effects
Scott Fraundorf628 views
Mixed Effects Models - Orthogonal Contrasts by Scott Fraundorf
Mixed Effects Models - Orthogonal ContrastsMixed Effects Models - Orthogonal Contrasts
Mixed Effects Models - Orthogonal Contrasts
Scott Fraundorf366 views
Mixed Effects Models - Crossed Random Effects by Scott Fraundorf
Mixed Effects Models - Crossed Random EffectsMixed Effects Models - Crossed Random Effects
Mixed Effects Models - Crossed Random Effects
Scott Fraundorf296 views
Mixed Effects Models - Signal Detection Theory by Scott Fraundorf
Mixed Effects Models - Signal Detection TheoryMixed Effects Models - Signal Detection Theory
Mixed Effects Models - Signal Detection Theory
Scott Fraundorf284 views
GOV.UK Digital Transformation Case by David Rozman
GOV.UK Digital Transformation CaseGOV.UK Digital Transformation Case
GOV.UK Digital Transformation Case
David Rozman1.7K views

Similar to Mixed Effects Models - Growth Curve Analysis

Basic Terms in Statistics by
Basic Terms in StatisticsBasic Terms in Statistics
Basic Terms in StatisticsSamuel John Parreño
19.4K views37 slides
Trends over time by
Trends over timeTrends over time
Trends over timedjleach
211 views11 slides
Unit 01 intro to statistics - 1 per page by
Unit 01    intro to statistics - 1 per pageUnit 01    intro to statistics - 1 per page
Unit 01 intro to statistics - 1 per pageMAKABANSA
804 views27 slides
Addictive links, Keynote talk at WWW 2014 workshop by
Addictive links, Keynote talk at WWW 2014 workshopAddictive links, Keynote talk at WWW 2014 workshop
Addictive links, Keynote talk at WWW 2014 workshopPeter Brusilovsky
1.2K views51 slides
Spss by
SpssSpss
SpssNazia Ashraf
4.8K views51 slides
Audio Lesson Plan 1 by
Audio Lesson Plan 1Audio Lesson Plan 1
Audio Lesson Plan 1cprue22
596 views8 slides

Similar to Mixed Effects Models - Growth Curve Analysis(20)

Trends over time by djleach
Trends over timeTrends over time
Trends over time
djleach211 views
Unit 01 intro to statistics - 1 per page by MAKABANSA
Unit 01    intro to statistics - 1 per pageUnit 01    intro to statistics - 1 per page
Unit 01 intro to statistics - 1 per page
MAKABANSA804 views
Addictive links, Keynote talk at WWW 2014 workshop by Peter Brusilovsky
Addictive links, Keynote talk at WWW 2014 workshopAddictive links, Keynote talk at WWW 2014 workshop
Addictive links, Keynote talk at WWW 2014 workshop
Peter Brusilovsky1.2K views
Audio Lesson Plan 1 by cprue22
Audio Lesson Plan 1Audio Lesson Plan 1
Audio Lesson Plan 1
cprue22596 views
Deming and Education by aghersi
Deming and EducationDeming and Education
Deming and Education
aghersi671 views
Sequencingr middleschool by Kelly Kellogg
Sequencingr middleschoolSequencingr middleschool
Sequencingr middleschool
Kelly Kellogg231 views
New York Survey DataInstructionsA consulting firm was hired to.docx by curwenmichaela
New York Survey DataInstructionsA consulting firm was hired to.docxNew York Survey DataInstructionsA consulting firm was hired to.docx
New York Survey DataInstructionsA consulting firm was hired to.docx
curwenmichaela19 views
CR Bio elc mtg 11/18 by jsilver
CR Bio elc mtg 11/18CR Bio elc mtg 11/18
CR Bio elc mtg 11/18
jsilver323 views
The Realization ConceptAuthor(s) 1964 Concepts and Sta.docx by durantheseldine
The Realization ConceptAuthor(s) 1964 Concepts and Sta.docxThe Realization ConceptAuthor(s) 1964 Concepts and Sta.docx
The Realization ConceptAuthor(s) 1964 Concepts and Sta.docx
durantheseldine5 views
Simmons curriculum design.ppt by MinBulay
Simmons curriculum design.pptSimmons curriculum design.ppt
Simmons curriculum design.ppt
MinBulay3 views
Transitioning to Common Core: What it means, What to look for by Curriculum Associates
Transitioning to Common Core: What it means, What to look forTransitioning to Common Core: What it means, What to look for
Transitioning to Common Core: What it means, What to look for
Fostering Curriculum Development Through Artesol 2010 by shierl
Fostering Curriculum Development Through Artesol 2010Fostering Curriculum Development Through Artesol 2010
Fostering Curriculum Development Through Artesol 2010
shierl671 views

More from Scott Fraundorf

Mixed Effects Models - Power by
Mixed Effects Models - PowerMixed Effects Models - Power
Mixed Effects Models - PowerScott Fraundorf
129 views60 slides
Mixed Effects Models - Missing Data by
Mixed Effects Models - Missing DataMixed Effects Models - Missing Data
Mixed Effects Models - Missing DataScott Fraundorf
88 views67 slides
Mixed Effects Models - Logit Models by
Mixed Effects Models - Logit ModelsMixed Effects Models - Logit Models
Mixed Effects Models - Logit ModelsScott Fraundorf
129 views71 slides
Mixed Effects Models - Level-2 Variables by
Mixed Effects Models - Level-2 VariablesMixed Effects Models - Level-2 Variables
Mixed Effects Models - Level-2 VariablesScott Fraundorf
119 views41 slides
Mixed Effects Models - Data Processing by
Mixed Effects Models - Data ProcessingMixed Effects Models - Data Processing
Mixed Effects Models - Data ProcessingScott Fraundorf
100 views39 slides
Scott_Fraundorf_Resume by
Scott_Fraundorf_ResumeScott_Fraundorf_Resume
Scott_Fraundorf_ResumeScott Fraundorf
24 views2 slides

More from Scott Fraundorf(6)

Mixed Effects Models - Missing Data by Scott Fraundorf
Mixed Effects Models - Missing DataMixed Effects Models - Missing Data
Mixed Effects Models - Missing Data
Scott Fraundorf88 views
Mixed Effects Models - Logit Models by Scott Fraundorf
Mixed Effects Models - Logit ModelsMixed Effects Models - Logit Models
Mixed Effects Models - Logit Models
Scott Fraundorf129 views
Mixed Effects Models - Level-2 Variables by Scott Fraundorf
Mixed Effects Models - Level-2 VariablesMixed Effects Models - Level-2 Variables
Mixed Effects Models - Level-2 Variables
Scott Fraundorf119 views
Mixed Effects Models - Data Processing by Scott Fraundorf
Mixed Effects Models - Data ProcessingMixed Effects Models - Data Processing
Mixed Effects Models - Data Processing
Scott Fraundorf100 views

Recently uploaded

Volf work.pdf by
Volf work.pdfVolf work.pdf
Volf work.pdfMariaKenney3
91 views43 slides
PRELIMS ANSWER.pptx by
PRELIMS ANSWER.pptxPRELIMS ANSWER.pptx
PRELIMS ANSWER.pptxsouravkrpodder
56 views60 slides
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx by
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxGuidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxNiranjan Chavan
43 views48 slides
JRN 362 - Lecture Twenty-Two by
JRN 362 - Lecture Twenty-TwoJRN 362 - Lecture Twenty-Two
JRN 362 - Lecture Twenty-TwoRich Hanley
39 views157 slides
MercerJesse3.0.pdf by
MercerJesse3.0.pdfMercerJesse3.0.pdf
MercerJesse3.0.pdfjessemercerail
183 views6 slides
The Picture Of A Photograph by
The Picture Of A PhotographThe Picture Of A Photograph
The Picture Of A PhotographEvelyn Donaldson
38 views81 slides

Recently uploaded(20)

Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx by Niranjan Chavan
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptxGuidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Guidelines & Identification of Early Sepsis DR. NN CHAVAN 02122023.pptx
Niranjan Chavan43 views
JRN 362 - Lecture Twenty-Two by Rich Hanley
JRN 362 - Lecture Twenty-TwoJRN 362 - Lecture Twenty-Two
JRN 362 - Lecture Twenty-Two
Rich Hanley39 views
JRN 362 - Lecture Twenty-Three (Epilogue) by Rich Hanley
JRN 362 - Lecture Twenty-Three (Epilogue)JRN 362 - Lecture Twenty-Three (Epilogue)
JRN 362 - Lecture Twenty-Three (Epilogue)
Rich Hanley44 views
JQUERY.pdf by ArthyR3
JQUERY.pdfJQUERY.pdf
JQUERY.pdf
ArthyR3114 views
ANGULARJS.pdf by ArthyR3
ANGULARJS.pdfANGULARJS.pdf
ANGULARJS.pdf
ArthyR354 views
Interaction of microorganisms with vascular plants.pptx by MicrobiologyMicro
Interaction of microorganisms with vascular plants.pptxInteraction of microorganisms with vascular plants.pptx
Interaction of microorganisms with vascular plants.pptx
The Future of Micro-credentials: Is Small Really Beautiful? by Mark Brown
The Future of Micro-credentials:  Is Small Really Beautiful?The Future of Micro-credentials:  Is Small Really Beautiful?
The Future of Micro-credentials: Is Small Really Beautiful?
Mark Brown121 views
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE... by Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (FRIE...
Guess Papers ADC 1, Karachi University by Khalid Aziz
Guess Papers ADC 1, Karachi UniversityGuess Papers ADC 1, Karachi University
Guess Papers ADC 1, Karachi University
Khalid Aziz109 views
Education of marginalized and socially disadvantages segments.pptx by GarimaBhati5
Education of marginalized and socially disadvantages segments.pptxEducation of marginalized and socially disadvantages segments.pptx
Education of marginalized and socially disadvantages segments.pptx
GarimaBhati552 views

Mixed Effects Models - Growth Curve Analysis

  • 1. Course Business ! Lab materials on Canvas ! Final project information will be posted on Canvas at 4:00 PM today • Final project: Analyze your own data • I can supply simulated data if needed—send me an intro & methods section for the data you’d like to analyze • In-class presentation: Last 2.5 weeks of class, beginning Nov. 9th • Sign up on Canvas for a time slot – first come, first served! • Final paper: Due on Canvas last day of class • Canvas will have more info. on requirements
  • 2. Week 11.1: Growth Curve Analysis ! Overview ! Reshaping Data ! Growth Curve Analysis ! Time as a Predictor Variable ! Quadratic & Higher Degrees ! Random Slopes ! Time-Variant & -Invariant Variables ! Breakpoints ! Lab
  • 4. Longitudinal Designs • There are many methods available for analyzing longitudinal data • Aidan Wright’s class on Applied Longitudinal Data Analysis • Mixed-effects models are one effective solution • Hierarchical models naturally account for longitudinal data • Include all of the other features we’ve looked at (multiple random effects, mix of categorical & continuous variables, non-normal DVs, etc.)
  • 5. School 1 School 2 Student 2 Student 1 Student 3 Student 4 Sampled SCHOOLS Sampled STUDENTS LEVEL 2 LEVEL 1 • What kind of random-effects structure is this? Longitudinal Data as Hierarchical Data
  • 6. School 1 School 2 Student 2 Student 1 Student 3 Student 4 Sampled SCHOOLS Sampled STUDENTS LEVEL 2 LEVEL 1 • What kind of random-effects structure is this? • Two levels of nesting – sample schools, then sample students inside each school Longitudinal Data as Hierarchical Data
  • 7. Student 1 Exam 1 Student 2 Exam 2 Student 3 Exam 1 Student 3 Exam 2 • Now imagine we observed each student several different times • e.g., midterm & final exam School 1 School 2 Student 2 Student 1 Student 3 Student 4 Sampled SCHOOLS Sampled STUDENTS LEVEL 2 LEVEL 1 Longitudinal Data as Hierarchical Data
  • 8. Student 1 Exam 1 Student 2 Exam 2 Student 3 Exam 1 Student 3 Exam 2 School 1 School 2 Student 2 Student 1 Student 3 Student 4 Sampled SCHOOLS Sampled STUDENTS LEVEL 3 LEVEL 2 • This is just another level of nesting • Sample schools • Sample student within each school • Sample time points within each student Longitudinal Data as Hierarchical Data Sampled TIME POINTS LEVEL 1
  • 9. Longitudinal Designs • Two big questions mixed-effects models can help us answer about longitudinal data: 1) What is the overall trajectory of change across time? " Today 2) How does an observation at one time point relate to the next time point? " Wednesday
  • 10. vocab.csv ! Role of language input in early vocab acquisition ! 200 kids from lower SES families: ! 100 families given books to read to their kids ! 100 waitlisted controls ! Vocab assessed every 2 months from 20 mos. to 28 mos. ! Research questions: ! What is the general trajectory of vocabulary acquisition in these ages? ! How is this altered by our intervention?
  • 11. Week 11.1: Growth Curve Analysis ! Overview ! Reshaping Data ! Growth Curve Analysis ! Time as a Predictor Variable ! Quadratic & Higher Degrees ! Random Slopes ! Time-Variant & -Invariant Variables ! Breakpoints ! Lab
  • 12. Long vs. Wide Format ! For lmer(), each observation needs its own row ! “long” format Time 1 row Time 2 gets a separate row One trial Another trial
  • 13. Long vs. Wide Format ! For lmer(), each observation needs its own row ! “long” format ! Sometimes data comes to us in “wide” format ! Each repeated measure is a different column in the same row ! e.g., what SPSS uses ! vocab.csv is in this format Time 1 and Time 2 are considered separate variables Time 1 row Time 2 gets a separate row
  • 14. Long vs. Wide Format ! Tidyverse contains very easy functions for pivoting data between formats ! pivot_longer(): To turn data into long format ! pivot_wider(): To turn data into wide format
  • 15. pivot_longer() ! Here is a look at our dataframe… We want to turn into each of these columns into a separate row
  • 16. pivot_longer() ! vocab %>% pivot_longer(cols=c('Month0','Month2','Month4’, 'Month6','Month8')) -> vocab.p ! Now we have five rows per child We want to turn into each of these columns into a separate row
  • 17. pivot_longer() ! By default, R saves the original column name in a variable called “name”, and the DV in a variable called “value” ! Not very informative ! We can specify better names : ! vocab %>% pivot_longer(cols=c('Month0','Month2','Month4’, 'Month6','Month8’), names_to='MonthsInStudy’, values_to='VocabWords') -> vocab.p
  • 18. pivot_longer() ! By default, R saves the original column name in a variable called “name”, and the DV in a variable called “value” ! Not very informative ! We can specify better names : ! vocab %>% pivot_longer(cols=c('Month0','Month2','Month4’, 'Month6','Month8’), names_to='MonthsInStudy’, values_to='VocabWords') -> vocab.p
  • 19. pivot_longer() ! What we’d really like is to turn MonthsIntoStudy into a numeric variable ! Currently, the values are “Month0,” “Month2,” etc., because those were the original column names ! Since these all start with the same prefix (Month), tidyverse can automatically strip that out for us ! vocab %>% pivot_longer(cols=c('Month0','Month2','Month4',' Month6','Month8’), names_to='MonthsInStudy', names_prefix='Month', values_to='VocabWords')-> vocab.p
  • 20. pivot_longer() ! What we’d really like is to turn MonthsIntoStudy into a numeric variable ! Currently, the values are “Month0,” “Month2,” etc., because those were the original column names ! Since these all start with the same prefix (Month), tidyverse can automatically strip that out for us ! vocab %>% pivot_longer(cols=c('Month0','Month2','Month4',' Month6','Month8’), names_to='MonthsInStudy', names_prefix='Month', values_to='VocabWords')-> vocab.p
  • 21. pivot_longer() ! Now, we can use as.numeric() on this variable ! vocab.p %>% mutate(MonthsInStudy=as.numeric(MonthsInStudy)) -> vocab.p
  • 22. pivot_longer() ! Now, we can use as.numeric() on this variable ! vocab.p %>% mutate(MonthsInStudy=as.numeric(MonthsInStudy)) -> vocab.p
  • 23. Week 11.1: Growth Curve Analysis ! Overview ! Reshaping Data ! Growth Curve Analysis ! Time as a Predictor Variable ! Quadratic & Higher Degrees ! Random Slopes ! Time-Variant & -Invariant Variables ! Breakpoints ! Lab
  • 24. vocab.csv ! Role of language input in early vocab acquisition ! 200 kids from lower SES families: ! 100 families given books to read to their kids ! 100 waitlisted controls ! Vocab assessed every 2 months from 20 mos. to 28 mos. ! Research questions: ! What is the general trajectory of vocabulary acquisition in these ages? ! How is this altered by our intervention?
  • 25. Longitudinal Designs • Two big questions mixed-effects models can help us answer about longitudinal data: 1) What is the overall trajectory of change across time? " Today: Growth curve analysis 2) How does an observation at one time point relate to the next time point? " Wednesday
  • 26. Time as a Predictor Variable • How does vocabulary change over time? • The simple way to answer this question: Add time as a variable in our model • Nothing “special” about time as a predictor
  • 27. Time as a Predictor Variable • Let’s add the effect of time to our model • Here: MonthsInStudy (starting at 0) • Fixed effect because we’re interested in time effects • model1 <- lmer(VocabWords ~ 1 + MonthsInStudy + (1|Child), data=vocab) • How would you interpret the two estimates? • Intercept: • Slope:
  • 28. Time as a Predictor Variable • Let’s add the effect of time to our model • Here: MonthsInStudy (starting at 0) • Fixed effect because we’re interested in time effects • model1 <- lmer(VocabWords ~ 1 + MonthsInStudy + (1|Child), data=vocab) • How would you interpret the two estimates? • Intercept: Average vocab ~51 words at start of study • Slope: Gain of about ~35 words per month
  • 29. Time as a Predictor Variable • Not necessary to have every time point represented • Don’t even have to be the same set of time points across participants • Time units also don’t matter as long as they’re consistent • Could be hours, days, years …
  • 30. Week 11.1: Growth Curve Analysis ! Overview ! Reshaping Data ! Growth Curve Analysis ! Time as a Predictor Variable ! Quadratic & Higher Degrees ! Random Slopes ! Time-Variant & -Invariant Variables ! Breakpoints ! Lab
  • 32. Quadratic & Higher Degrees • We’ve been assuming a linear effect of time
  • 33. Quadratic & Higher Degrees • But, it looks like vocab growth may accelerate • Growth between 0 mo. and 2 mo. is much smaller than growth between 6 mo. and 8 mo. • Suggests a curve / quadratic equation
  • 34. Quadratic & Higher Degrees • Add quadratic effect (MonthsInStudy2): • model.poly <- lmer(VocabWords ~ 1 + poly(MonthsInStudy,degree=2,raw=TRUE) + (1|Child), data=vocab.p) • degree=2 because we want MonthsInStudy2 • poly() automatically adds lower-order terms as well • i.e., the linear term (MonthsInStudy1) • raw=TRUE to keep the original scale of the variables (time measured in months)
  • 35. Quadratic & Higher Degrees • Results: • Implied equation (approximate): • VocabWords = 75 + 11*Months + 3*Months2 • What are predicted values if… • Month=0? • Month=1? • Month=2? Intercept Linear term Quadratic term
  • 36. Quadratic & Higher Degrees • Results: • Implied equation (approximate): • VocabWords = 75 + 11*Months + 3*Months2 • What are predicted values if… • Month=0? • Month=1? • Month=2? • Vocab growth is accelerating (larger change from month 1 to month 2 than from month 0 to month 1) Intercept Linear term Quadratic term VocabWords=75+(11*0)+(3*02) = 75 VocabWords=75+(11*1)+(3*12) = 89 VocabWords=75+(11*2)+(3*22) = 109 +20 +14
  • 37. POSITIVE QUADRATIC TREND & NO LINEAR TREND NEGATIVE QUADRATIC TREND & NO LINEAR TREND POSITIVE QUADRATIC TREND & POSITIVE LINEAR TREND NEGATIVE QUADRATIC TREND & POSITIVE LINEAR TREND Different patterns of quadratic & linear effects in a GCA describe different curves
  • 38. POSITIVE QUADRATIC TREND & NO LINEAR TREND NEGATIVE QUADRATIC TREND & NO LINEAR TREND POSITIVE QUADRATIC TREND & POSITIVE LINEAR TREND NEGATIVE QUADRATIC TREND & POSITIVE LINEAR TREND • Linear trend: Is there an overall increase over time (+), decrease (-), or no change? • Quadratic trend: Is the line curved up (+), down (-), or straight?
  • 39. Quadratic & Higher Degrees • The Yerkes-Dodson law (Yerkes & Dodson, 1908) describes the optimal level of physiological arousal to perform a task: Low arousal results in poor performance because you are not alert enough, medium arousal results in strong performance, and high arousal results in poor performance because you are too anxious. Linear trend: Quadratic trend:
  • 40. Quadratic & Higher Degrees • The Yerkes-Dodson law (Yerkes & Dodson, 1908) describes the optimal level of physiological arousal to perform a task: Low arousal results in poor performance because you are not alert enough, medium arousal results in strong performance, and high arousal results in poor performance because you are too anxious. Linear trend: Quadratic trend: NONE NEGATIVE
  • 41. Quadratic & Higher Degrees • In adulthood, working memory declines the older you get (Park et al., 2002). Linear trend: Quadratic trend:
  • 42. Quadratic & Higher Degrees • In adulthood, working memory declines the older you get (Park et al., 2002). Linear trend: Quadratic trend: NONE NEGATIVE
  • 43. Quadratic & Higher Degrees • Aphasia is a neuropsychological disorder that disrupts speech, often resulting from a stroke. After initially acquiring aphasia, patients often experience rapid recovery in much of their language performance (dependent variable) as time (independent variable) increases. But, this recovery eventually slows down, and language performance doesn’t get much better no matter how much more time increases (e.g., Demeurisse et al., 1980). Linear trend: Quadratic trend:
  • 44. Quadratic & Higher Degrees • Aphasia is a neuropsychological disorder that disrupts speech, often resulting from a stroke. After initially acquiring aphasia, patients often experience rapid recovery in much of their language performance (dependent variable) as time (independent variable) increases. But, this recovery eventually slows down, and language performance doesn’t get much better no matter how much more time increases (e.g., Demeurisse et al., 1980). Linear trend: Quadratic trend: POSITIVE NEGATIVE
  • 45. Quadratic & Higher Degrees • Studies of practice and expertise (e.g., Logan, 1988) show that people learning to do a task—such as arithmetic—initially show a quick decrease in response time (dependent variable) as the amount of practice increases. However, eventually they hit the point where the task can’t possibly be done any faster, and response time reaches an asymptote and stops decreasing. Linear trend: Quadratic trend:
  • 46. Quadratic & Higher Degrees • Studies of practice and expertise (e.g., Logan, 1988) show that people learning to do a task—such as arithmetic—initially show a quick decrease in response time (dependent variable) as the amount of practice increases. However, eventually they hit the point where the task can’t possibly be done any faster, and response time reaches an asymptote and stops decreasing. Linear trend: Quadratic trend: NEGATIVE POSITIVE
  • 47. Quadratic & Higher Degrees • Could go up to even higher degrees (Time3, Time4…) • degree=3 if highest exponent is 3 • Degree minus 1 = Number of bends in the curve -100 -50 0 50 100 x^3 0 20 40 60 80 100 x^1 0 20 40 60 80 100 x^2 0 bends 1 bend 2 bends
  • 48. Quadratic & Higher Degrees • Maximum degree of polynomial: # of time points minus 1 • Example: 2 time points perfectly fit by a line (degree 1). Nothing left for a quadratic term to explain. • But, don’t want to overfit • Probably not the case that the real underlying (population) trajectory has 6 bends in it • What degree should we include? • Theoretical considerations • If comparing conditions, look at mean trajectory across conditions (Mirman et al., 2008)
  • 49. Week 11.1: Growth Curve Analysis ! Overview ! Reshaping Data ! Growth Curve Analysis ! Time as a Predictor Variable ! Quadratic & Higher Degrees ! Random Slopes ! Time-Variant & -Invariant Variables ! Breakpoints ! Lab
  • 50. Child 2 Child 1 Child 3 Child 4 Child 1 Assess- ment 1 Child 2 Assess- ment 2 Child 3 Assess- ment 1 Child 3 Assess- ment 2 Sampled CHILDREN Sampled TIME POINTS LEVEL 2 LEVEL 1 • So far, we assume the same growth rate for all kids • Almost certainly not true! • At level 2, we’re sampling kids both with different starting points (intercepts) and growth rates (slopes) Longitudinal Data: Random Slopes Growth Rate 1 Growth Rate 2
  • 51. Longitudinal Data: Random Slopes RANDOM INTERCEPTS MODEL Kids vary in starting point, but all acquire vocabulary at the same rate over this period WITH RANDOM SLOPES Allows rate of vocab acquisition to vary across kids (as well as intercept)
  • 52. • Let’s allow the MonthsInStudy effect to be different for each Child • model.Slope <- lmer(VocabWords ~ 1 + poly(MonthsInStudy,degree=2,raw=TRUE) + (1 + poly(MonthsInStudy,degree=2,raw=TRUE)|Child), data=vocab.p) Longitudinal Data: Random Slopes Child 2 Child 1 Child 3 Child 4 Child 1 Assess- ment 1 Child 2 Assess- ment 2 Child 3 Assess- ment 1 Child 3 Assess- ment 2 Sampled CHILDREN Sampled TIME POINTS LEVEL 2 LEVEL 1 Growth Rate 1 Growth Rate 2
  • 53. Longitudinal Data: Random Slopes Substantial variability in the MonthsInStudy slope SD of the slope across children is ~5 words Mean slope is 11 words/mo, but some kids might have a slope of 6 or 16
  • 54. Week 11.1: Growth Curve Analysis ! Overview ! Reshaping Data ! Growth Curve Analysis ! Time as a Predictor Variable ! Quadratic & Higher Degrees ! Random Slopes ! Time-Variant & -Invariant Variables ! Breakpoints ! Lab
  • 55. Time-Variant & -Invariant Variables • We may want to include other (experimental or observational) variables in a GCA model: • e.g., our reading intervention • MonthsInStudy + Reading • Effect of Reading invariant across time • Can only affect the intercept (parallel lines) • MonthsInStudy * Reading • Effect of Reading varies with time • Can affect intercept & slope
  • 56. Time-Variant & -Invariant Variables • Fixed-effect results with the interaction: e.g., Huttenlocher et al., 1991 Also results in faster vocab growth (amplifies + Time effect) Linear growth rate for “No” group: 8.4 words / month Linear growth rate for “Yes” group: 8.4 + 4.7 = 13.1 words / month Effect of reading at time 0 (intercept): ~6 words No effect on curvature (quadratic term)
  • 57. Time-Variant & -Invariant Variables • Can be either: • Time-Invariant Predictor: Same across all time points within a subject • e.g., our intervention, race/ethnicity • Level 2 variables • Time-Varying Predictor: Varies even within a subject, from one time point to another • e.g., hours of sleep, mood • Level-1 variable Child 2 Child 1 Child 1 Assess- ment 1 Child 2 Assess- ment 2 Sampled CHILDREN Sampled TIME POINTS LEVEL 2 LEVEL 1 • Since R automatically figures out what’s a level-1 vs. level-2 variable, we don’t have to do anything special for either kind of variable
  • 58. Week 11.1: Growth Curve Analysis ! Overview ! Reshaping Data ! Growth Curve Analysis ! Time as a Predictor Variable ! Quadratic & Higher Degrees ! Random Slopes ! Time-Variant & -Invariant Variables ! Breakpoints ! Lab
  • 59. ! Another possibility (in general) is a qualitative change in the trajectory at some point in the range of time observed ! e.g., age of majority, public policy changes, etc. ! Include a breakpoint—a categorical variable that represents whether or not you’re above the point at which the change happens ! mydata %>% mutate(Year2015OrLater= ifelse(Year >= 2015, 1, 0))-> mydata ! New variable is: ! 0 before 2015 ! 1 for 2015 onwards Breakpoints
  • 60. ! Another possibility (in general) is a qualitative change in the trajectory at some point in the range of time observed ! e.g., age of majority, public policy changes, etc. ! Include a breakpoint—a categorical variable that represents whether or not you’re above the point at which the change happens Breakpoints Main effect of breakpoint only – single shift downward (or upward) but same slope Main effect of breakpoint & an interaction – slope also changes
  • 61. ! Can apply this technique to any continuous variables, not just time ! e.g., above/below the poverty line ! As with higher-order polynomials, be wary of overfitting the data ! Most effective if we have an a priori reason to expect a breakpoint somewhere ! Or, use cross-validation to support a more exploratory analysis Breakpoints
  • 62. Week 11.1: Growth Curve Analysis ! Overview ! Reshaping Data ! Growth Curve Analysis ! Time as a Predictor Variable ! Quadratic & Higher Degrees ! Random Slopes ! Time-Variant & -Invariant Variables ! Breakpoints ! Lab