Skip to content

Commit 491ec54

Browse files
20260116 - latent basis growth curve model
1 parent b4fa010 commit 491ec54

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sem.qmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ ggplot(
414414
lbgcm1_syntax <- '
415415
# Intercept and slope
416416
intercept =~ 1*t1 + 1*t2 + 1*t3 + 1*t4
417-
slope =~ 0*t1 + a*t2 + b*t3 + 3*t4 # freely estimate the loadings for t2 and t3
417+
slope =~ 0*t1 + a*t2 + b*t3 + 1*t4 # freely estimate the loadings for t2 and t3
418418
419419
# Regression paths
420420
intercept ~ x1 + x2
@@ -434,7 +434,7 @@ lbgcm1_syntax <- '
434434
lbgcm2_syntax <- '
435435
# Intercept and slope
436436
intercept =~ 1*t1 + 1*t2 + 1*t3 + 1*t4
437-
slope =~ 0*t1 + a*t2 + b*t3 + 3*t4 # freely estimate the loadings for t2 and t3
437+
slope =~ 0*t1 + a*t2 + b*t3 + 1*t4 # freely estimate the loadings for t2 and t3
438438
439439
# Regression paths
440440
intercept ~ x1 + x2
@@ -589,7 +589,7 @@ timepoints <- 4
589589
590590
newData <- data.frame(
591591
time = 1:4,
592-
slopeloading = c(0, lbgcm1_slopeloadingt2, lbgcm1_slopeloadingt3, 3)
592+
slopeloading = c(0, lbgcm1_slopeloadingt2, lbgcm1_slopeloadingt3, 1)
593593
)
594594
595595
newData$predictedValue <- NA
@@ -611,7 +611,7 @@ ggplot(
611611
person_factors <- as.data.frame(predict(lbgcm1_fit))
612612
person_factors$id <- rownames(person_factors)
613613
614-
slope_loadings <- c(0, lbgcm1_slopeloadingt2, lbgcm1_slopeloadingt3, 3)
614+
slope_loadings <- c(0, lbgcm1_slopeloadingt2, lbgcm1_slopeloadingt3, 1)
615615
616616
# Compute model-implied values for each person at each time point
617617
individual_trajectories <- person_factors %>%

0 commit comments

Comments
 (0)