1 / 57

Growth Modeling

Growth Modeling. The aim of growth modeling is to look at the rate of change of a variable over time. Example : attitudes, profits, working speed, life satisfaction. Potential growth patterns can be linear, quadratic, cubic, logarithmic, exponential.

nigelb
Télécharger la présentation

Growth Modeling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Growth Modeling

  2. The aim of growth modeling is to look at the rate of change of a variable over time. Example : attitudes, profits, working speed, life satisfaction. Potential growth patterns can be linear, quadratic, cubic, logarithmic, exponential. The hierarchy in the data is that time points are nested within people (or other entities).

  3. Possible Growth Curves : Cubic Trend Quadratic Trend Linear Trend

  4. Two important things : Growth curve can be fitted up to one less than the number of time points that we have. Example : With three time points, a linear and quadratic growth curve can be fitted. 2. A growth curve is defined by a power function. Linear (Time) Quadratic (Time*Time) Cubic (Time*Time*Time) Quartic (Time*Time*Time*Time)

  5. Life Satisfaction Over Time

  6. LS_Data

  7. Person : 115 subject • Gender : 0, 1 • Time : 4 points of time : • Satisfaction Base (0) • Satisfaction 6 Months (1) • Satisfaction 12 Months (2) • Satisfaction 18 Months (3) • LS : Life Satisfaction on a 10-point scale (0 = completely dissatisfied, 10 = completely satisfied)

  8. Data setwd) satisfactionData <- read.delim("LS_Data.dat", header=TRUE) library("reshape") LS <- melt(satisfactionData,id=c("Person","Gender"), measured=c("Satisfaction_Base", "Satisfaction_6_Months","Satisfaction_12_Months", "Satisfaction_18_Months")) Time<-c(rep(0,115),rep(1,115),rep(2,115),rep(3,115)) LS$Time<-Time rm(Time) head(LS)

  9. Data LS_Data<- data.frame(Person = LS$Person, Gender=LS$Gender, Time =LS$Time, LS=LS$value) head(LS_Data)

  10. Nonlinear Mixed Effects Models (nlme) install.packages(“nlme”) library("nlme")

  11. Model 1 Intercept-only ; no predictors Model is specified as y ~ 1 Code : intercept <- gls(LS ~ 1, data=LS_Data, method="ML", na.action=na.exclude) Pred_Y1 <- predict(intercept) # Predicted Y / Regression Line Pred_Y1 <- as.vector(Pred_Y) summary(intercept) intervals(intercept)

  12. Model 1 head(LS_D1) Person Gender Time LS Pred_Y 1 1 0 0 6 5.988584 2 1 0 1 6 5.988584 3 1 0 2 5 5.988584 4 1 0 3 2 5.988584 5 2 1 0 7 5.988584 6 2 1 1 7 5.988584

  13. Model 2 Intercept vary across people : Code : randomIntercept <- lme(LS ~ 1, data = LS_Data, random = ~1|Person, method = "ML", na.action = na.exclude, control = list(opt="optim"))

  14. Model 2 Pred_Y2 <- predict(randomIntercept) Pred_Y2 <- as.vector(Pred_Y2) summary(randomIntercept) intervals(randomIntercept)

  15. Model 2 head(LS_D2) Person Gender Time LS Pred_Y 1 1 0 0 6 5.084936 2 1 0 1 6 5.084936 3 1 0 2 5 5.084936 4 1 0 3 2 5.084936 5 2 1 0 7 6.355934 6 2 1 1 7 6.355934

  16. Footer text: to modify choose 'View' (Office 2003 or earlier) or 'Insert' (Office 2007 or later) then 'Header & Footer'

  17. Model 3 Random Intercept across people + Time as a predictor : Time as a fixed effect Code : timeRI <- update(randomIntercept, .~. + Time) timeRI <- lme(LS ~ Time, data = LS_Data, random = ~1|Person, method = "ML", na.action = na.exclude, control = list(opt="optim"))

  18. Model 3 Code : Pred_Y3 <- predict(timeRI) Pred_Y3 <- as.vector(Pred_Y3) summary(timeRI) intervals(timeRI) coef(timeRI)

  19. Model 3 head(coef(timeRI)) (Intercept) Time 1 6.269597 -0.8772182 2 7.707617 -0.8772182 3 5.242440 -0.8772182 4 6.475028 -0.8772182 5 7.502185 -0.8772182 6 6.680460 -0.8772182

  20. Footer text: to modify choose 'View' (Office 2003 or earlier) or 'Insert' (Office 2007 or later) then 'Header & Footer'

  21. Growth Modeling Rate of development /growth over time differs within entities

  22. Model 4 Effect of Time across people : timeRS <- update(timeRI, random = ~Time|Person) or timeRS <- lme(LS ~ Time, data = LS_Data, random = ~Time|Person, method = "ML", na.action = na.exclude, control = list(opt="optim"))

  23. Model 4 Pred_Y4 <- predict(timeRS) Pred_Y4 <- as.vector(Pred_Y4) summary(timeRS) intervals(timeRS) coef(timeRS)

  24. Model 4 head(coef(timeRS)) (Intercept) Time 1 6.338484 -0.9234636 2 7.705109 -0.8732796 3 5.198861 -0.8586077 4 6.725606 -1.0345095 5 7.317987 -0.7622338 6 6.814232 -0.9616653

  25. Model 5 First Order Autoregressive ARModel <- update(timeRS, correlation = corAR1(0, form = ~Time|Person)) ARModel <- lme(LS ~ Time, data = LS_Data, random = ~Time|Person, method = "ML", na.action = na.exclude, control = list(opt="optim"), correlation = corAR1(0, form = ~Time|Person))

  26. Model 5 Pred_Y5 <- predict(ARModel) Pred_Y5 <- as.vector(Pred_Y5) summary(ARModel) intervals(ARModel) coef(ARModel)

  27. Model 5 head(coef(ARModel)) (Intercept) Time 1 6.296443 -0.8711929 2 7.528736 -0.8702692 3 5.418097 -0.8692794 4 6.414589 -0.8733059 5 7.409368 -0.8674247 6 6.569258 -0.8714521

  28. Footer text: to modify choose 'View' (Office 2003 or earlier) or 'Insert' (Office 2007 or later) then 'Header & Footer'

  29. Comparing 5 models : anova(intercept, randomIntercept, timeRI, timeRS, ARModel)

  30. Footer text: to modify choose 'View' (Office 2003 or earlier) or 'Insert' (Office 2007 or later) then 'Header & Footer'

  31. Quadratic TrendModel 6 If time is the predictor variable, a quadratic is tested by including a predictor timeQuadratic <- update(ARModel, .~. + I(Time^2)) Or : timeQuadratic <- lme(LS ~ Time+I(Time^2), data = LS_Data, random = ~Time|Person, method = "ML", na.action= na.exclude, control = list(opt="optim"), correlation = corAR1(0, form = ~Time|Person))

  32. Cubic TrendModel 7 timeCubic<-update(timeQuadratic, .~. + I(Time^3)) timeCubic<- lme(LS ~ Time+I(Time^2)+I(Time^3), data = LS_Data, random = ~Time|Person, method = "ML", na.action= na.exclude, control = list(opt="optim"), correlation = corAR1(0, form = ~Time|Person))

  33. Comparing 3 models : anova(ARModel, timeQuadratic, timeCubic)

  34. Footer text: to modify choose 'View' (Office 2003 or earlier) or 'Insert' (Office 2007 or later) then 'Header & Footer'

  35. Quadratic TrendModel 8 Update Model 3 : Mod8 <- update(timeRI, .~. + I(Time^2)) Mod8 <- lme(LS ~ Time+I(Time^2), data = LS_Data, random = ~1|Person, method = "ML", na.action= na.exclude, control = list(opt="optim"))

  36. Model 8 summary(Mod8) intervals(Mod8) Pred_Y8 <- predict(Mod8) Pred_Y8 <- as.vector(Pred_Y8)

  37. Model 8 coef(Mod8) head(coef(Mod8)) (Intercept) Time I(Time^2) 1 5.739092 0.7352972 -0.5512887 2 7.232865 0.7352972 -0.5512887 3 4.672111 0.7352972 -0.5512887 4 5.952488 0.7352972 -0.5512887 5 7.019469 0.7352972 -0.5512887 • 6.165884 0.7352972 -0.5512887

  38. Model 8 # Data frame LS_D8 <- data.frame(Person = LS_Data$Person[c(1,116,231,346,2,117,232,347,3,118,233,348,4,119,234,349,5,120,235,350,6,121,236,351)], Gender=LS_Data$Gender[c(1,116,231,346,2,117,232,347,3,118,233,348,4,119,234,349,5,120,235,350,6,121,236,351)], Time =LS_Data$Time[c(1,116,231,346,2,117,232,347,3,118,233,348,4,119,234,349,5,120,235,350,6,121,236,351)], LS=LS_Data$LS[c(1,116,231,346,2,117,232,347,3,118,233,348,4,119,234,349,5,120,235,350,6,121,236,351)], Pred_Y=Pred_Y8[c(1,116,231,346,2,117,232,347,3,118,233,348,4,119,234,349,5,120,235,350,6,121,236,351)])

  39. Model 8 head(LS_D8) Person Gender Time LS Pred_Y 1 1 0 0 6 5.739092 2 1 0 1 6 5.923100 3 1 0 2 5 5.004531 4 1 0 3 2 2.983385 5 2 1 0 7 7.232865 6 2 1 1 7 7.416873

  40. Model 8 ## GGPLOT library(ggplot2) plot <- ggplot(LS_D8, aes(x=LS_D8[,3], y=LS_D8[,5],colour=factor(LS_D8[,1]))) plot + layer(geom="point") + layer(geom="line")+ xlab("Time")+ylab("LS")+ ggtitle("Regression Line / Predicted Y")+labs(colour= "Person")

  41. Footer text: to modify choose 'View' (Office 2003 or earlier) or 'Insert' (Office 2007 or later) then 'Header & Footer'

  42. Cubic TrendModel 9 Mod9 <-update(Mod8, .~. + I(Time^3)) Mod9 <- lme(LS ~ Time+I(Time^2) +I(Time^3), data = LS_Data, random = ~1|Person, method = "ML", na.action= na.exclude, control = list(opt="optim"))

  43. Model 9 Code : summary(Mod9) intervals(Mod9) Pred_Y9 <- predict(Mod9) Pred_Y9 <- as.vector(Pred_Y9)

More Related