You are on page 1of 33

Growth

 curve  analysis  (in  R)

Block  4b
GCA:  Outline
1. Introduc@on  to  growth  curve  analysis
2. Basics  of  R
3. GCA  in  R
– Uncondi@onal  growth  models
– Condi@onal  growth  models
– Within-­‐individual  effects
– Model  comparison
GCA:  Introduc@on
• Mul@level  polynomial
curve-­‐fiNng  approach
for  longitudinal  data.
• Data  that  describes  how
individuals  in  a  sample
change  over  @me.
GCA  &  The  Visual  World
• Visual  world  paradigm:
track  listeners’  eye
movements  as  they
hear  language  related
to  a  visual  scene.

“The  woman  will  move  the  glass  onto  the  table.”


A.  “And  then,  she  will  pour  the  wine  carefully  into  the  glass.”
B.  “But  first,  she  will  pour  the  wine  carefully    into  the  glass.”
(see  Altmann  &  Kamide,  2009)
GCA  &  The  Visual  World
• Outcome:  propor@ons
of  fixa@ons.
• Time:  ms.
• Research  ques:on:  (1)
how  do  propor@ons  of
fixa@ons  change  over
@me;  (2)  does  this
change  differ  between
condi@ons  (And  vs  But)?
GCA  &  The  Visual  World
• Growth  Curve  Analysis:
– Regression+
– Fit  polynomial  curves  to
the  over-­‐@me  data.
– Test  whether  curves
differ  reliably  between
condi@ons.
Regression+
• Linear  regression:
– Y  =  β0  +  β1  *  X
– Β0  :  Intercept
– β1  :  Slope
• Growth  curve:
– X  is  Time Slope
– Maximum  likelihood
– Mul@level Intercept
– Specify  fixed  &  random
effects
Regression+:  Mul@level

Across-­‐individual  growth Within-­‐individual  growth


Reading  in  your  data

> data <- read.csv(file="C:/GrowthCurveAnalysisInR/data.csv”)

Assign  (save)  data Read  in  .csv  data  file Specify  the  file
to  object  “data.” (func@on  “read.csv”). name  &  loca@on.
Looking  at  your  data

> data

Print  the  contents  of


“data”  onscreen.
Looking  at  your  data

> data$Subject

Print  the  contents  of  the  variable  (i.e.,  column)


“Subject”  in  “data”  onscreen  (use  “$”).
Looking  at  your  data

> str(data)

Print  informa@on  about


the  contents  of  “data.”
Categorical  variables

> data$Subject <- factor(data$Subject)

Assign  (save)  back  as Change  into    a Specify  the  variable


the  same  variable. categorical  variable. of  interest.
GCA  in  R
• Modeling  strategy:
Increasing
– Uncondi@onal  growth  models complexity  (more
model  parameters)
• Linear  change  over  @me.
• Non-­‐linear  change  over  @me.
– Condi@onal  growth  models
• Effect  of  condi@on  on  the  intercept.
• Effect  of  condi@on  on  the  slope.
• Effect  of  condi@on  on  higher  order  terms.
Uncondi@onal  growth  models
• No  independent
variables  in  model. 1  point  of  inflec@on

• Form  of  change  over


@me?
• Linear:  y  ~  Time
• Quadra:c:  y  ~  Time2
• Cubic:  y  ~  Time3
Uncondi@onal  growth  models

Collapse  across
condi@ons,  groups,  etc.
Load  nlme  library

> library(nlme)

Load  “nlme”  library  (set  of


func@ons,  etc.).
Linear  change  (Time)

> m1 <- lme(Fixs.Glass ~ Wave, data=data, random= ~ Wave | Subject, method="ML")

Assign  output Outcome Time(varia Object Subject


to  “m1” (variable). ble). containing  data. (variable).
Linear  change  (Time)

> summary(m1)

Print  summary  of  model


results.
Linear  change  (Time)

Fixed  effects

Y  =  .106  +  .014  *  Time


Slope  =  .014
Intercept  =  .106
Quadra@c  change  (Time )
2

> m2 <- lme(Fixs.Glass ~ Wave + I(Wave^2), data=data, random= ~ Wave | Subject,


method="ML")

Time  (variable)
squared.
Quadra@c  change  (Time )
2

Fixed  effects

Y  =  .080  +  .026  *  Time  -­‐  .0008  *  Time2


Cubic  change  (Time )
3

> m3 <- lme(Fixs.Glass ~ Wave + I(Wave^2) + I(Wave^3), data=data, random= ~ Wave |


Subject, method="ML")

Time  (variable)
cubed.
Cubic  change  (Time )
3

Fixed  effects

Y  =  .079  +  .028  *  Time  -­‐  .001  *  Time2  +  .00001  *  Time3


Condi@onal  growth  models
• Add  independent
variables  to  the
uncondi@onal  growth
model.
• Differences  between
condi@ons  (And  vs
But)in  the  over-­‐@me
change?
Effect  of  condi@on  on  the  intercept

> m2a <- lme(Fixs.Glass ~ Wave + I(Wave^2) + Condition, data=data, random= ~ Wave |
Subject, method="ML")

Condi@on(v
ariable).
Effect  of  condi@on  on  the  intercept

Fixed  effects

Y  =  .059  +  .026  *  Time  -­‐  .001  *  Time2


             +  .043  *  Condi:on
But  Intercept  =  .  059+.043
And  Intercept  =  .  059
And:  Condi@on  =  0
But:  Condi@on  =  1
Effect  of  condi@on  on  Time

> m2b <- lme(Fixs.Glass ~ Wave + I(Wave^2) + Condition + Wave*Condition, data=data,


random= ~ Wave | Subject, method="ML")

Time  (variable)  *
Condi@on(variable).
Effect  of  condi@on  on  Time

Fixed  effects

Y  =  .087  +  .022  *  Time  -­‐  .0008  *  Time2


             -­‐  .014  *  Condi:on  +  .008  *  Time*Condi:on

And:  Condi@on  =  0
But:  Condi@on  =  1
Model  comparisons

> anova(m1, m2)

Models  to
compare.
Model  comparisons

> 1 - pchisq(m1$logLik*-2 - m2$logLik*-2, 1)

Compute  p-­‐value  for  change Subtract  log  likelihoods  of df  =  difference  in  number
in  -­‐2  log  likelihood. two  models  (use  “$logLik”). of  parameters
Summary

Χ2(df  =  1)  ~  4, Y  =  Time Y  =  Time  +  Time2 Y  =  Time  +  Time2  +  Time3


p  <  .05. -­‐2LL  =  -­‐1858 -­‐2LL  =  -­‐1878 -­‐2LL  =  -­‐1879

Y  =  ...  +  Condi:on*Time2 Y  =  …  +  Condi:on*Time Y  =  Time  +  Time2  +  Condi:on


-­‐2LL  =  -­‐1962 -­‐2LL  =  -­‐1962 -­‐2LL  =  -­‐1928
GCA:  References
• Singer,  J.  D.,  &  Willeu,  J.B.  (2003).  Applied  longitudinal  data  analysis:  Modeling
change  and  event  occurrence.  New  York:  Oxford  University  Press.
• Mirman,  D.  Dixon,  J.A.,  &  Magnuson,  J.S.  (2008).  Sta@s@cal  and  computa@onal
models  of  the  visual  world  paradigm:  Growth  curves  and  individual  differences.
Journal  of  Memory  and  Language,  59,  475-­‐494.
– hup://www.danmirman.org/gca

You might also like