library(lavaan)
## This is lavaan 0.6-15
## lavaan is FREE software! Please report any bugs.
library(semTools)
##
## ###############################################################################
## This is semTools 0.5-6
## All users of R (or SEM) are invited to submit functions or ideas for functions.
## ###############################################################################
library(semPlot)
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:semTools':
##
## reliability, skew
## The following object is masked from 'package:lavaan':
##
## cor2cov
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2
## ──
## ✔ ggplot2 3.4.0 ✔ purrr 0.3.5
## ✔ tibble 3.1.8 ✔ dplyr 1.0.10
## ✔ tidyr 1.2.1 ✔ stringr 1.4.1
## ✔ readr 2.1.3 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ ggplot2::%+%() masks psych::%+%()
## ✖ ggplot2::alpha() masks psych::alpha()
## ✖ readr::clipboard() masks semTools::clipboard()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
#loading data
HW2_TimeData <- read.csv("WLS_HW2_Time.csv", header=TRUE)
head(HW2_TimeData)
## idpub sexrsp byear educ92 age04 age11 Simil_2004 Digits_2004 LFLU_2004
## 1 905087 1 37 13 66 NA 8 12 12
## 2 905118 2 39 12 65 71 2 9 13
## 3 901295 2 40 12 64 70 10 10 8
## 4 922383 2 38 12 66 NA 0 NA 6
## 5 904612 1 38 12 65 73 4 9 6
## 6 900877 1 37 12 66 73 7 7 14
## CFLU_2004 Simil_2011 Digits_2011 LFLU_2011 CFLU_2011 TotRecall_2004
## 1 17 NA NA NA NA 12
## 2 NA 3 9 13 NA 9
## 3 NA 7 7 11 NA 6
## 4 16 NA NA NA NA NA
## 5 18 6 10 7 23 9
## 6 NA 6 8 7 NA 9
## TotRecall_2011 N_04 N_11
## 1 NA 4 0
## 2 11 3 3
## 3 9 3 3
## 4 NA 3 0
## 5 11 4 4
## 6 10 3 3
#Calculating descriptives for my data set, beginning with the gender of my participants. I'll have (1=male, 2=female)
Gender <- factor(HW2_TimeData$sexrsp, levels = 1:2, labels = c("Male", "Female"))
summary(Gender)
## Male Female
## 3277 3801
#gender is fairly well distributed, slightly more females.
#Next I'll go through and look at the age of my participants. Using the mutate function to make a new column because the age data is #only provided within the data by birth year
data <- mutate(HW2_TimeData, Age = 103-(HW2_TimeData$byear))
psych::describe(data$Age)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 7078 64.14 0.5 64 64.09 0 63 66 3 1.04 2.77 0.01
#Now I'll look at the education levels of my participants.
library(tidyverse) #needed to change the code
data$educ92 <- as.numeric(data$educ92)
psych::describe(data$educ92)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6858 13.71 2.3 12 13.32 0 12 21 9 1.05 -0.17 0.03
#this looks a bit deceptive because the SD is 2.26. Might be better off reporting the median.
#Reading in data for nationality since it wasn't in the dataset for HW2.
data <- read.csv("Data_HW1.csv")
#And now I'll look at the nationality data. Beginning with nationality on the father's side. I know this #variable was coded with a #ton of options from reviewing the codebook. Beginning here by checking to see how R #coded the variable.
glimpse(data$ge096fa)
## int [1:9688] NA 14 4 NA 2 14 14 NA 14 14 ...
#R coded this as an interval, so I'll change it to a factor since I know this variable has a ton of levels to it
data$ge096fa <- as.factor(data$ge096fa)
summary(data$ge096fa)
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## 633 108 52 463 549 166 128 182 6 82 81 231 4 3417 474 202
## 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33
## 43 21 47 4 20 10 91 3 8 21 55 2 1 1 1 1
## 34 35 36 37 38 39 40 41 42 NA's
## 1 5 16 11 20 9 16 11 4 2488
#Repeating this same process for the nationality on the mother's side
glimpse(data$ge095ma)
## int [1:9688] NA 4 1 NA 41 14 4 NA 14 14 ...
data$ge095ma <- as.factor(data$ge095ma)
summary(data$ge095ma)
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## 622 91 38 495 554 151 104 168 28 75 81 218 14 3106 527 192
## 17 18 19 20 22 23 24 25 26 27 28 30 32 33 35 36
## 48 31 59 3 50 7 80 5 8 32 36 1 1 1 2 16
## 37 38 39 40 41 42 43 44 46 47 NA's
## 8 58 26 27 32 11 3 1 1 1 2676
#Now I'll keep prepping the data for analysis. Sub-setting the neuropsyhological tests
TimeData_T <- HW2_TimeData[,(7:14)]
# Sub-setting time 1 variables
TimeData_T1 <- TimeData_T[,(1:4)]
#Sub-setting time 2 variables
TimeData_T2 <- TimeData_T[,(5:8)]
#Running the correlation matrix
corMat <- cor(TimeData_T, use = "pairwise.complete.obs")
corMat
## Simil_2004 Digits_2004 LFLU_2004 CFLU_2004 Simil_2011 Digits_2011
## Simil_2004 1.0000000 0.1856831 0.2387166 0.2349456 0.5568106 0.1634219
## Digits_2004 0.1856831 1.0000000 0.1902411 0.1690608 0.1501103 0.3478980
## LFLU_2004 0.2387166 0.1902411 1.0000000 0.3370050 0.2054583 0.2107888
## CFLU_2004 0.2349456 0.1690608 0.3370050 1.0000000 0.2384257 0.2326793
## Simil_2011 0.5568106 0.1501103 0.2054583 0.2384257 1.0000000 0.2095168
## Digits_2011 0.1634219 0.3478980 0.2107888 0.2326793 0.2095168 1.0000000
## LFLU_2011 0.2395870 0.1955691 0.5916502 0.3155063 0.2499542 0.2739231
## CFLU_2011 0.2180568 0.1784553 0.2969536 0.5905128 0.2429890 0.2703994
## LFLU_2011 CFLU_2011
## Simil_2004 0.2395870 0.2180568
## Digits_2004 0.1955691 0.1784553
## LFLU_2004 0.5916502 0.2969536
## CFLU_2004 0.3155063 0.5905128
## Simil_2011 0.2499542 0.2429890
## Digits_2011 0.2739231 0.2703994
## LFLU_2011 1.0000000 0.3493626
## CFLU_2011 0.3493626 1.0000000
describe(corMat)
## vars n mean sd median trimmed mad min max range skew kurtosis
## Simil_2004 1 8 0.35 0.29 0.24 0.35 0.05 0.16 1 0.84 1.34 0.22
## Digits_2004 2 8 0.30 0.29 0.19 0.30 0.02 0.15 1 0.85 1.71 1.31
## LFLU_2004 3 8 0.38 0.28 0.27 0.38 0.10 0.19 1 0.81 1.24 0.00
## CFLU_2004 4 8 0.39 0.28 0.28 0.39 0.08 0.17 1 0.83 1.24 0.02
## Simil_2011 5 8 0.36 0.29 0.24 0.36 0.05 0.15 1 0.85 1.34 0.21
## Digits_2011 6 8 0.34 0.27 0.25 0.34 0.06 0.16 1 0.84 1.71 1.35
## LFLU_2011 7 8 0.40 0.27 0.29 0.40 0.08 0.20 1 0.80 1.27 0.09
## CFLU_2011 8 8 0.39 0.28 0.28 0.39 0.10 0.18 1 0.82 1.25 0.04
## se
## Simil_2004 0.1
## Digits_2004 0.1
## LFLU_2004 0.1
## CFLU_2004 0.1
## Simil_2011 0.1
## Digits_2011 0.1
## LFLU_2011 0.1
## CFLU_2011 0.1
#As expected, I'm seeing a relationship between all of the tests in 2004 and 2011. What's interesting is that
#category fluency is correlating more strongly with letter fluency when compared to the other relationships.
#this makes sense, however, they're both measures of semantic fluency.
#running the covariance matrix
covMat <- cov(TimeData_T, use = "pairwise.complete.obs")
covMat
## Simil_2004 Digits_2004 LFLU_2004 CFLU_2004 Simil_2011 Digits_2011
## Simil_2004 5.657111 1.331131 2.417782 3.346110 3.044747 1.006587
## Digits_2004 1.331131 9.417145 2.510843 3.157940 1.052011 2.762883
## LFLU_2004 2.417782 2.510843 18.940356 8.928069 2.057132 2.397620
## CFLU_2004 3.346110 3.157940 8.928069 37.754144 3.328515 3.679962
## Simil_2011 3.044747 1.052011 2.057132 3.328515 5.384844 1.271686
## Digits_2011 1.006587 2.762883 2.397620 3.679962 1.271686 6.902690
## LFLU_2011 2.327008 2.464364 10.640388 7.860272 2.399484 2.973873
## CFLU_2011 2.993917 3.200140 7.657134 21.265482 3.323114 4.173102
## LFLU_2011 CFLU_2011
## Simil_2004 2.327008 2.993917
## Digits_2004 2.464364 3.200140
## LFLU_2004 10.640388 7.657134
## CFLU_2004 7.860272 21.265482
## Simil_2011 2.399484 3.323114
## Digits_2011 2.973873 4.173102
## LFLU_2011 17.488017 8.685133
## CFLU_2011 8.685133 35.660451
describe(covMat)
## vars n mean sd median trimmed mad min max range skew
## Simil_2004 1 8 2.77 1.43 2.71 2.77 0.76 1.01 5.66 4.65 0.68
## Digits_2004 2 8 3.24 2.62 2.64 3.24 0.80 1.05 9.42 8.37 1.52
## LFLU_2004 3 8 6.94 5.94 5.08 6.94 4.24 2.06 18.94 16.88 0.83
## CFLU_2004 4 8 11.17 12.35 5.77 11.17 3.75 3.16 37.75 34.60 1.19
## Simil_2011 5 8 2.73 1.38 2.72 2.73 0.94 1.05 5.38 4.33 0.52
## Digits_2011 6 8 3.15 1.86 2.87 3.15 1.57 1.01 6.90 5.90 0.72
## LFLU_2011 7 8 6.85 5.43 5.42 6.85 4.53 2.33 17.49 15.16 0.73
## CFLU_2011 8 8 10.87 11.71 5.92 10.87 4.07 2.99 35.66 32.67 1.14
## kurtosis se
## Simil_2004 -0.48 0.51
## Digits_2004 0.98 0.93
## LFLU_2004 -0.71 2.10
## CFLU_2004 -0.18 4.37
## Simil_2011 -0.86 0.49
## Digits_2011 -0.57 0.66
## LFLU_2011 -0.93 1.92
## CFLU_2011 -0.33 4.14
#here I'm also noticing that there's a weaker covariance between digit sequencing in 2004/2011. whereas the
#other tests are covarying more strongly together across time. This could be because digit sequencing is the
#most cognitively demanding of the tests I'm analyzing. This may be most sensitive to decline.
# building my first model of configural invariance
# I'll do this by equating 1 set of lambdas and one set of intercepts
model.CI <- '
#Latent variables
CogT1 =~ NA*Simil_2004 + a*Simil_2004 + Digits_2004 + LFLU_2004 + CFLU_2004
CogT2 =~ NA*Simil_2011 + a*Simil_2011 + Digits_2011 + LFLU_2011 + CFLU_2011
# Residuals
Simil_2004 ~~ Simil_2004
Simil_2011 ~~ Simil_2011
Digits_2004 ~~ Digits_2004
Digits_2011 ~~ Digits_2011
LFLU_2004 ~~ LFLU_2004
LFLU_2011 ~~ LFLU_2011
CFLU_2004 ~~ CFLU_2004
CFLU_2011 ~~ CFLU_2011
# Residual covariances
Simil_2004 ~~ Simil_2011
Digits_2004 ~~ Digits_2011
LFLU_2004 ~~ LFLU_2011
CFLU_2004 ~~ CFLU_2011
# Intercepts
Simil_2004 ~ nu1*1
Simil_2011 ~ nu1*1
Digits_2004 ~ nu11*1
Digits_2011 ~ nu12*1
LFLU_2004 ~ nu21*1
LFLU_2011 ~ nu22*1
CFLU_2004 ~ nu31*1
CFLU_2011 ~ nu32*1
#Latent variances/covariances
#Standardized CogT1
CogT1 ~~ 1*CogT1
#covariance
CogT2 ~~ cov*CogT1
#variance Time 2
CogT2 ~~ NA*CogT2
#Latent means
CogT1 ~ a1*1
CogT2 ~ a2*1
a1 == 0
'
model.CI.fit <- sem(model.CI, data=HW2_TimeData, missing = "FIML")
model.CI.fit
## lavaan 0.6.15 ended normally after 107 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
## Number of equality constraints 3
##
## Number of observations 7078
## Number of missing patterns 75
##
## Model Test User Model:
##
## Test statistic 28.999
## Degrees of freedom 15
## P-value (Chi-square) 0.016
summary(model.CI.fit, fit.measures = TRUE, standardized = T)
## lavaan 0.6.15 ended normally after 107 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
## Number of equality constraints 3
##
## Number of observations 7078
## Number of missing patterns 75
##
## Model Test User Model:
##
## Test statistic 28.999
## Degrees of freedom 15
## P-value (Chi-square) 0.016
##
## Model Test Baseline Model:
##
## Test statistic 7086.446
## Degrees of freedom 28
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.998
## Tucker-Lewis Index (TLI) 0.996
##
## Robust Comparative Fit Index (CFI) 0.998
## Robust Tucker-Lewis Index (TLI) 0.996
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -95272.349
## Loglikelihood unrestricted model (H1) -95257.849
##
## Akaike (AIC) 190602.698
## Bayesian (BIC) 190801.775
## Sample-size adjusted Bayesian (SABIC) 190709.620
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.011
## 90 Percent confidence interval - lower 0.005
## 90 Percent confidence interval - upper 0.018
## P-value H_0: RMSEA <= 0.050 1.000
## P-value H_0: RMSEA >= 0.080 0.000
##
## Robust RMSEA 0.016
## 90 Percent confidence interval - lower 0.004
## 90 Percent confidence interval - upper 0.026
## P-value H_0: Robust RMSEA <= 0.050 1.000
## P-value H_0: Robust RMSEA >= 0.080 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.010
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## CogT1 =~
## Simil_2004 (a) 1.059 0.041 25.767 0.000 1.059 0.445
## Digts_2004 1.105 0.057 19.421 0.000 1.105 0.360
## LFLU_2004 2.491 0.086 28.845 0.000 2.491 0.570
## CFLU_2004 3.496 0.138 25.380 0.000 3.496 0.568
## CogT2 =~
## Simil_2011 (a) 1.059 0.041 25.767 0.000 1.021 0.439
## Digts_2011 1.252 0.073 17.163 0.000 1.207 0.458
## LFLU_2011 2.700 0.142 19.020 0.000 2.604 0.620
## CFLU_2011 3.600 0.205 17.582 0.000 3.472 0.578
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Simil_2004 ~~
## .Sml_2011 2.117 0.082 25.680 0.000 2.117 0.475
## .Digits_2004 ~~
## .Dgt_2011 1.658 0.125 13.276 0.000 1.658 0.247
## .LFLU_2004 ~~
## .LFLU_201 5.098 0.328 15.523 0.000 5.098 0.431
## .CFLU_2004 ~~
## .CFLU_201 11.024 0.750 14.698 0.000 11.024 0.444
## CogT1 ~~
## CogT2 (cov) 0.883 0.039 22.402 0.000 0.915 0.915
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Sm_2004 (nu1) 6.577 0.029 229.089 0.000 6.577 2.763
## .Sm_2011 (nu1) 6.577 0.029 229.089 0.000 6.577 2.827
## .Dg_2004 (nu11) 7.197 0.042 171.902 0.000 7.197 2.344
## .Dg_2011 (nu12) 7.086 0.055 129.049 0.000 7.086 2.690
## .LFLU_20 (nu21) 11.327 0.059 190.461 0.000 11.327 2.592
## .LFLU_20 (nu22) 11.782 0.100 117.506 0.000 11.782 2.804
## .CFLU_20 (nu31) 20.782 0.103 201.946 0.000 20.782 3.376
## .CFLU_20 (nu32) 20.306 0.155 130.890 0.000 20.306 3.381
## CogT1 (a1) 0.000 0.000 0.000
## CogT2 (a2) -0.281 0.030 -9.391 0.000 -0.292 -0.292
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Simil_2004 4.543 0.102 44.745 0.000 4.543 0.802
## .Simil_2011 4.371 0.103 42.293 0.000 4.371 0.807
## .Digits_2004 8.207 0.181 45.225 0.000 8.207 0.871
## .Digits_2011 5.483 0.145 37.705 0.000 5.483 0.790
## .LFLU_2004 12.890 0.414 31.121 0.000 12.890 0.675
## .LFLU_2011 10.878 0.397 27.434 0.000 10.878 0.616
## .CFLU_2004 25.668 0.922 27.830 0.000 25.668 0.677
## .CFLU_2011 24.018 0.937 25.621 0.000 24.018 0.666
## CogT1 1.000 1.000 1.000
## CogT2 0.930 0.075 12.335 0.000 1.000 1.000
##
## Constraints:
## |Slack|
## a1 - 0 0.000
semPaths(model.CI.fit, what = "est")

#Easy to see that this model fits well, which it should. All fit indices look good.
#moving on to my second model, my weak model, where I'll keep the equated components of my first model and
#lso equate all sets of factor loadings
model.weak <- '
# Latent variables
CogT1 =~ NA*Simil_2004 + a*Simil_2004 + b*Digits_2004 + c*LFLU_2004 + d*CFLU_2004
CogT2 =~ NA*Simil_2011 + a*Simil_2011 + b*Digits_2011 + c*LFLU_2011 + d*CFLU_2011
# Residuals
Simil_2004 ~~ Simil_2004
Simil_2011 ~~ Simil_2011
Digits_2004 ~~ Digits_2004
Digits_2011 ~~ Digits_2011
LFLU_2004 ~~ LFLU_2004
LFLU_2011 ~~ LFLU_2011
CFLU_2004 ~~ CFLU_2004
CFLU_2011 ~~ CFLU_2011
# Residual covariances
Simil_2004 ~~ Simil_2011
Digits_2004 ~~ Digits_2011
LFLU_2004 ~~ LFLU_2011
CFLU_2004 ~~ CFLU_2011
# Intercepts
Simil_2004 ~ nu1*1
Simil_2011 ~ nu1*1
Digits_2004 ~ nu11*1
Digits_2011 ~ nu12*1
LFLU_2004 ~ nu21*1
LFLU_2011 ~ nu22*1
CFLU_2004 ~ nu31*1
CFLU_2011 ~ nu32*1
# Latent variances/covariances
# Standardized CogT1
CogT1 ~~ 1*CogT1
# Covariance
CogT2 ~~ cov*CogT1
# Variance Time 2
CogT2 ~~ NA*CogT2
# Latent means
CogT1 ~ a1*1
CogT2 ~ a2*1
a1 == 0
'
model.weak.fit <- sem(model.weak, data = HW2_TimeData, missing = "FIML")
model.weak.fit
## lavaan 0.6.15 ended normally after 92 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
## Number of equality constraints 6
##
## Number of observations 7078
## Number of missing patterns 75
##
## Model Test User Model:
##
## Test statistic 33.392
## Degrees of freedom 18
## P-value (Chi-square) 0.015
summary(model.weak.fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6.15 ended normally after 92 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
## Number of equality constraints 6
##
## Number of observations 7078
## Number of missing patterns 75
##
## Model Test User Model:
##
## Test statistic 33.392
## Degrees of freedom 18
## P-value (Chi-square) 0.015
##
## Model Test Baseline Model:
##
## Test statistic 7086.446
## Degrees of freedom 28
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.998
## Tucker-Lewis Index (TLI) 0.997
##
## Robust Comparative Fit Index (CFI) 0.998
## Robust Tucker-Lewis Index (TLI) 0.997
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -95274.545
## Loglikelihood unrestricted model (H1) -95257.849
##
## Akaike (AIC) 190601.091
## Bayesian (BIC) 190779.574
## Sample-size adjusted Bayesian (SABIC) 190696.952
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.011
## 90 Percent confidence interval - lower 0.005
## 90 Percent confidence interval - upper 0.017
## P-value H_0: RMSEA <= 0.050 1.000
## P-value H_0: RMSEA >= 0.080 0.000
##
## Robust RMSEA 0.015
## 90 Percent confidence interval - lower 0.003
## 90 Percent confidence interval - upper 0.024
## P-value H_0: Robust RMSEA <= 0.050 1.000
## P-value H_0: Robust RMSEA >= 0.080 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.012
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## CogT1 =~
## Simil_2004 (a) 1.034 0.038 27.566 0.000 1.034 0.435
## Digts_2004 (b) 1.153 0.044 26.035 0.000 1.153 0.374
## LFLU_2004 (c) 2.526 0.077 32.628 0.000 2.526 0.577
## CFLU_2004 (d) 3.457 0.123 28.184 0.000 3.457 0.563
## CogT2 =~
## Simil_2011 (a) 1.034 0.038 27.566 0.000 1.051 0.450
## Digts_2011 (b) 1.153 0.044 26.035 0.000 1.172 0.446
## LFLU_2011 (c) 2.526 0.077 32.628 0.000 2.567 0.612
## CFLU_2011 (d) 3.457 0.123 28.184 0.000 3.513 0.584
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Simil_2004 ~~
## .Sml_2011 2.113 0.083 25.584 0.000 2.113 0.474
## .Digits_2004 ~~
## .Dgt_2011 1.649 0.125 13.223 0.000 1.649 0.246
## .LFLU_2004 ~~
## .LFLU_201 5.101 0.329 15.525 0.000 5.101 0.430
## .CFLU_2004 ~~
## .CFLU_201 11.011 0.750 14.682 0.000 11.011 0.443
## CogT1 ~~
## CogT2 (cov) 0.932 0.025 37.366 0.000 0.917 0.917
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Sm_2004 (nu1) 6.577 0.029 229.588 0.000 6.577 2.770
## .Sm_2011 (nu1) 6.577 0.029 229.588 0.000 6.577 2.819
## .Dg_2004 (nu11) 7.196 0.042 171.458 0.000 7.196 2.336
## .Dg_2011 (nu12) 7.070 0.053 134.534 0.000 7.070 2.693
## .LFLU_20 (nu21) 11.327 0.060 190.161 0.000 11.327 2.586
## .LFLU_20 (nu22) 11.756 0.095 123.203 0.000 11.756 2.803
## .CFLU_20 (nu31) 20.786 0.103 202.173 0.000 20.786 3.383
## .CFLU_20 (nu32) 20.292 0.152 133.925 0.000 20.292 3.371
## CogT1 (a1) 0.000 NA 0.000 0.000
## CogT2 (a2) -0.289 0.030 -9.544 0.000 -0.285 -0.285
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Simil_2004 4.571 0.099 46.015 0.000 4.571 0.810
## .Simil_2011 4.340 0.102 42.628 0.000 4.340 0.797
## .Digits_2004 8.158 0.177 45.969 0.000 8.158 0.860
## .Digits_2011 5.520 0.143 38.626 0.000 5.520 0.801
## .LFLU_2004 12.796 0.402 31.810 0.000 12.796 0.667
## .LFLU_2011 11.001 0.380 28.968 0.000 11.001 0.625
## .CFLU_2004 25.811 0.891 28.954 0.000 25.811 0.684
## .CFLU_2011 23.884 0.916 26.060 0.000 23.884 0.659
## CogT1 1.000 1.000 1.000
## CogT2 1.033 0.043 24.023 0.000 1.000 1.000
##
## Constraints:
## |Slack|
## a1 - 0 0.000
semPaths(model.weak.fit, what = "est")

#this model improves from my first. Fit indices are stronger and AIC and BIC come into play and I can see that
#those values are better, meaning this is more parsimonious as well.
#Now I'll build my strong model, keeping everything from my last two models and adding the additional constraint
#of equating all of the intercepts.
model.strong <- '
# Latent variables
CogT1 =~ NA*Simil_2004 + a*Simil_2004 + b*Digits_2004 + c*LFLU_2004 + d*CFLU_2004
CogT2 =~ NA*Simil_2011 + a*Simil_2011 + b*Digits_2011 + c*LFLU_2011 + d*CFLU_2011
# Residuals
Simil_2004 ~~ Simil_2004
Simil_2011 ~~ Simil_2011
Digits_2004 ~~ Digits_2004
Digits_2011 ~~ Digits_2011
LFLU_2004 ~~ LFLU_2004
LFLU_2011 ~~ LFLU_2011
CFLU_2004 ~~ CFLU_2004
CFLU_2011 ~~ CFLU_2011
# Residual covariances
Simil_2004 ~~ Simil_2011
Digits_2004 ~~ Digits_2011
LFLU_2004 ~~ LFLU_2011
CFLU_2004 ~~ CFLU_2011
# Intercepts
Simil_2004 ~ nu1*1
Simil_2011 ~ nu1*1
Digits_2004 ~ nu11*1
Digits_2011 ~ nu11*1
LFLU_2004 ~ nu21*1
LFLU_2011 ~ nu21*1
CFLU_2004 ~ nu31*1
CFLU_2011 ~ nu31*1
# Latent variances/covariances
# Standardized CogT1
CogT1 ~~ 1*CogT1
# Covariance
CogT2 ~~ cov*CogT1
# Variance Time 2
CogT2 ~~ NA*CogT2
# Latent means
CogT1 ~ a1*1
CogT2 ~ a2*1
a1 == 0
'
model.strong.fit <- sem(model.strong, data = HW2_TimeData, missing = "FIML")
model.strong.fit
## lavaan 0.6.15 ended normally after 87 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
## Number of equality constraints 9
##
## Number of observations 7078
## Number of missing patterns 75
##
## Model Test User Model:
##
## Test statistic 109.972
## Degrees of freedom 21
## P-value (Chi-square) 0.000
summary(model.strong.fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6.15 ended normally after 87 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
## Number of equality constraints 9
##
## Number of observations 7078
## Number of missing patterns 75
##
## Model Test User Model:
##
## Test statistic 109.972
## Degrees of freedom 21
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 7086.446
## Degrees of freedom 28
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.987
## Tucker-Lewis Index (TLI) 0.983
##
## Robust Comparative Fit Index (CFI) 0.987
## Robust Tucker-Lewis Index (TLI) 0.983
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -95312.835
## Loglikelihood unrestricted model (H1) -95257.849
##
## Akaike (AIC) 190671.670
## Bayesian (BIC) 190829.560
## Sample-size adjusted Bayesian (SABIC) 190756.471
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.024
## 90 Percent confidence interval - lower 0.020
## 90 Percent confidence interval - upper 0.029
## P-value H_0: RMSEA <= 0.050 1.000
## P-value H_0: RMSEA >= 0.080 0.000
##
## Robust RMSEA 0.034
## 90 Percent confidence interval - lower 0.028
## 90 Percent confidence interval - upper 0.041
## P-value H_0: Robust RMSEA <= 0.050 1.000
## P-value H_0: Robust RMSEA >= 0.080 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.021
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## CogT1 =~
## Simil_2004 (a) 1.046 0.036 28.741 0.000 1.046 0.440
## Digts_2004 (b) 1.182 0.044 27.108 0.000 1.182 0.383
## LFLU_2004 (c) 2.361 0.074 31.954 0.000 2.361 0.542
## CFLU_2004 (d) 3.624 0.120 30.146 0.000 3.624 0.586
## CogT2 =~
## Simil_2011 (a) 1.046 0.036 28.741 0.000 1.069 0.458
## Digts_2011 (b) 1.182 0.044 27.108 0.000 1.208 0.459
## LFLU_2011 (c) 2.361 0.074 31.954 0.000 2.412 0.578
## CFLU_2011 (d) 3.624 0.120 30.146 0.000 3.704 0.610
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Simil_2004 ~~
## .Sml_2011 2.084 0.082 25.493 0.000 2.084 0.471
## .Digits_2004 ~~
## .Dgt_2011 1.599 0.124 12.852 0.000 1.599 0.240
## .LFLU_2004 ~~
## .LFLU_201 5.563 0.314 17.693 0.000 5.563 0.446
## .CFLU_2004 ~~
## .CFLU_201 10.176 0.746 13.633 0.000 10.176 0.422
## CogT1 ~~
## CogT2 (cov) 0.941 0.025 37.130 0.000 0.920 0.920
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Sm_2004 (nu1) 6.572 0.027 245.557 0.000 6.572 2.766
## .Sm_2011 (nu1) 6.572 0.027 245.557 0.000 6.572 2.816
## .Dg_2004 (nu11) 7.124 0.035 205.432 0.000 7.124 2.309
## .Dg_2011 (nu11) 7.124 0.035 205.432 0.000 7.124 2.706
## .LFLU_20 (nu21) 11.528 0.054 214.558 0.000 11.528 2.648
## .LFLU_20 (nu21) 11.528 0.054 214.558 0.000 11.528 2.761
## .CFLU_20 (nu31) 20.567 0.096 213.699 0.000 20.567 3.323
## .CFLU_20 (nu31) 20.567 0.096 213.699 0.000 20.567 3.389
## CogT1 (a1) 0.000 0.000 0.000
## CogT2 (a2) -0.275 0.017 -16.088 0.000 -0.269 -0.269
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Simil_2004 4.550 0.099 45.980 0.000 4.550 0.806
## .Simil_2011 4.304 0.101 42.642 0.000 4.304 0.790
## .Digits_2004 8.126 0.178 45.630 0.000 8.126 0.853
## .Digits_2011 5.472 0.143 38.216 0.000 5.472 0.790
## .LFLU_2004 13.387 0.383 34.915 0.000 13.387 0.706
## .LFLU_2011 11.608 0.361 32.174 0.000 11.608 0.666
## .CFLU_2004 25.170 0.903 27.881 0.000 25.170 0.657
## .CFLU_2011 23.105 0.923 25.044 0.000 23.105 0.627
## CogT1 1.000 1.000 1.000
## CogT2 1.045 0.044 23.829 0.000 1.000 1.000
##
## Constraints:
## |Slack|
## a1 - 0 0.000
semPaths(model.strong.fit, what = "est")

#Oh, the fit worsens here. AIC and BIC increased. But RMSEA is still good and CFI and TLI are still really good.
#So I can proceed to the strict model, even though this model fit is a little bit worse.
#Building my final model, the strict model where everything remains the same except additional constraints are
#added and all of my residuals are equated to one another as well.
model.strict <- '
# Latent variables
CogT1 =~ NA*Simil_2004 + a*Simil_2004 + b*Digits_2004 + c*LFLU_2004 + d*CFLU_2004
CogT2 =~ NA*Simil_2011 + a*Simil_2011 + b*Digits_2011 + c*LFLU_2011 + d*CFLU_2011
# Residuals
NA*Simil_2004 ~~ e*Simil_2004
NA*Simil_2011 ~~ e*Simil_2011
NA*Digits_2004 ~~ f*Digits_2004
NA*Digits_2011 ~~ f*Digits_2011
NA*LFLU_2004 ~~ g*LFLU_2004
NA*LFLU_2011 ~~ g*LFLU_2011
NA*CFLU_2004 ~~ h*CFLU_2004
NA*CFLU_2011 ~~ h*CFLU_2011
# Residual covariances
Simil_2004 ~~ Simil_2011
Digits_2004 ~~ Digits_2011
LFLU_2004 ~~ LFLU_2011
CFLU_2004 ~~ CFLU_2011
# Intercepts
Simil_2004 ~ nu1*1
Simil_2011 ~ nu1*1
Digits_2004 ~ nu11*1
Digits_2011 ~ nu11*1
LFLU_2004 ~ nu21*1
LFLU_2011 ~ nu21*1
CFLU_2004 ~ nu31*1
CFLU_2011 ~ nu31*1
# Latent variances/covariances
# Standardized CogT1
CogT1 ~~ 1*CogT1
# Covariance
CogT2 ~~ cov*CogT1
# Variance Time 2
CogT2 ~~ NA*CogT2
# Latent means
CogT1 ~ a1*1
CogT2 ~ a2*1
a1 == 0
'
model.strict.fit <- sem(model.strict, data = HW2_TimeData, missing = "FIML")
model.strict.fit
## lavaan 0.6.15 ended normally after 75 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
## Number of equality constraints 13
##
## Number of observations 7078
## Number of missing patterns 75
##
## Model Test User Model:
##
## Test statistic 291.616
## Degrees of freedom 25
## P-value (Chi-square) 0.000
summary(model.strict.fit, fit.measures = TRUE, standardized = TRUE)
## lavaan 0.6.15 ended normally after 75 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 32
## Number of equality constraints 13
##
## Number of observations 7078
## Number of missing patterns 75
##
## Model Test User Model:
##
## Test statistic 291.616
## Degrees of freedom 25
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 7086.446
## Degrees of freedom 28
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.962
## Tucker-Lewis Index (TLI) 0.958
##
## Robust Comparative Fit Index (CFI) 0.965
## Robust Tucker-Lewis Index (TLI) 0.961
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -95403.657
## Loglikelihood unrestricted model (H1) -95257.849
##
## Akaike (AIC) 190845.314
## Bayesian (BIC) 190975.744
## Sample-size adjusted Bayesian (SABIC) 190915.367
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.039
## 90 Percent confidence interval - lower 0.035
## 90 Percent confidence interval - upper 0.043
## P-value H_0: RMSEA <= 0.050 1.000
## P-value H_0: RMSEA >= 0.080 0.000
##
## Robust RMSEA 0.052
## 90 Percent confidence interval - lower 0.046
## 90 Percent confidence interval - upper 0.058
## P-value H_0: Robust RMSEA <= 0.050 0.280
## P-value H_0: Robust RMSEA >= 0.080 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.041
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## CogT1 =~
## Simil_2004 (a) 1.091 0.037 29.821 0.000 1.091 0.461
## Digts_2004 (b) 1.208 0.046 26.532 0.000 1.208 0.416
## LFLU_2004 (c) 2.425 0.075 32.527 0.000 2.425 0.565
## CFLU_2004 (d) 3.703 0.121 30.602 0.000 3.703 0.599
## CogT2 =~
## Simil_2011 (a) 1.091 0.037 29.821 0.000 1.046 0.446
## Digts_2011 (b) 1.208 0.046 26.532 0.000 1.158 0.402
## LFLU_2011 (c) 2.425 0.075 32.527 0.000 2.324 0.549
## CFLU_2011 (d) 3.703 0.121 30.602 0.000 3.549 0.583
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Simil_2004 ~~
## .Sml_2011 2.069 0.083 25.044 0.000 2.069 0.469
## .Digits_2004 ~~
## .Dgt_2011 1.702 0.131 12.992 0.000 1.702 0.244
## .LFLU_2004 ~~
## .LFLU_201 5.569 0.318 17.540 0.000 5.569 0.444
## .CFLU_2004 ~~
## .CFLU_201 10.412 0.754 13.816 0.000 10.412 0.426
## CogT1 ~~
## CogT2 (cov) 0.885 0.022 40.260 0.000 0.923 0.923
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Sm_2004 (nu1) 6.572 0.027 244.621 0.000 6.572 2.776
## .Sm_2011 (nu1) 6.572 0.027 244.621 0.000 6.572 2.801
## .Dg_2004 (nu11) 7.136 0.035 206.075 0.000 7.136 2.459
## .Dg_2011 (nu11) 7.136 0.035 206.075 0.000 7.136 2.476
## .LFLU_20 (nu21) 11.504 0.054 214.995 0.000 11.504 2.681
## .LFLU_20 (nu21) 11.504 0.054 214.995 0.000 11.504 2.716
## .CFLU_20 (nu31) 20.573 0.096 213.681 0.000 20.573 3.331
## .CFLU_20 (nu31) 20.573 0.096 213.681 0.000 20.573 3.380
## CogT1 (a1) 0.000 0.000 0.000
## CogT2 (a2) -0.264 0.016 -16.084 0.000 -0.276 -0.276
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Simil_2004 (e) 4.414 0.083 53.253 0.000 4.414 0.788
## .Simil_2011 (e) 4.414 0.083 53.253 0.000 4.414 0.801
## .Digts_2004 (f) 6.966 0.126 55.373 0.000 6.966 0.827
## .Digts_2011 (f) 6.966 0.126 55.373 0.000 6.966 0.839
## .LFLU_2004 (g) 12.534 0.314 39.936 0.000 12.534 0.681
## .LFLU_2011 (g) 12.534 0.314 39.936 0.000 12.534 0.699
## .CFLU_2004 (h) 24.448 0.762 32.101 0.000 24.448 0.641
## .CFLU_2011 (h) 24.448 0.762 32.101 0.000 24.448 0.660
## CogT1 1.000 1.000 1.000
## CogT2 0.919 0.036 25.423 0.000 1.000 1.000
##
## Constraints:
## |Slack|
## a1 - 0 0.000
semPaths(model.strict.fit, what = "est")

#Once again, my model weakens when compared to my last. AIC and BIC go up again, but RMSEA and CFI and TLI are
#all still technically considered good. This means that I've achieved strict measurement invariance.
#Now I can look at my mean differences and variances across time point 1 and time point 2. There is such a small
#difference here. It really makes it critical that I established measurement invariance because without it, it
#would be difficult to say if this was really a change. My variance is 0.91, just the slightest decline across
#time. However, this makes sense because my population is not impaired and they're in their 60s. So I would not
#expect to see a huge drop off in these tests.
#Now I'll look at fit comparisions across models
Mod.Fit.Comp <- compareFit(model.CI.fit, model.weak.fit, model.strong.fit, model.strict.fit)
summary(Mod.Fit.Comp)
## ################### Nested Model Comparison #########################
##
## Chi-Squared Difference Test
##
## Df AIC BIC Chisq Chisq diff RMSEA Df diff
## model.CI.fit 15 190603 190802 28.999
## model.weak.fit 18 190601 190780 33.392 4.393 0.008100 3
## model.strong.fit 21 190672 190830 109.972 76.580 0.058866 3
## model.strict.fit 25 190845 190976 291.616 181.644 0.079212 4
## Pr(>Chisq)
## model.CI.fit
## model.weak.fit 0.222
## model.strong.fit <2e-16 ***
## model.strict.fit <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ####################### Model Fit Indices ###########################
## chisq df pvalue rmsea cfi tli srmr aic
## model.CI.fit 28.999† 15 .016 .011 0.998† 0.996 .010† 190602.698
## model.weak.fit 33.392 18 .015 .011† 0.998 0.997† .012 190601.091†
## model.strong.fit 109.972 21 .000 .024 .987 .983 .021 190671.670
## model.strict.fit 291.616 25 .000 .039 .962 .958 .041 190845.314
## bic
## model.CI.fit 190801.775
## model.weak.fit 190779.574†
## model.strong.fit 190829.560
## model.strict.fit 190975.744
##
## ################## Differences in Fit Indices #######################
## df rmsea cfi tli srmr aic
## model.weak.fit - model.CI.fit 3 0.000 0.000 0.000 0.001 -1.607
## model.strong.fit - model.weak.fit 3 0.013 -0.010 -0.013 0.009 70.580
## model.strict.fit - model.strong.fit 4 0.014 -0.025 -0.025 0.020 173.644
## bic
## model.weak.fit - model.CI.fit -22.201
## model.strong.fit - model.weak.fit 49.985
## model.strict.fit - model.strong.fit 146.185
#As I saw as I was running them, my weak model is technically my best fitting model for the data, however my
#other models are not bad enough that I have to toss them out. I can achieve strict invariance. You can see what
#a jump occurs in chi-square even just between strict and strong. The difference is 181.64, which is huge.
#the model definitely gets weaker as these additional constraints are added.
#Retrieving session information
sessionInfo()
## R version 4.2.2 (2022-10-31)
## Platform: aarch64-apple-darwin20 (64-bit)
## Running under: macOS Monterey 12.4
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] forcats_0.5.2 stringr_1.4.1 dplyr_1.0.10 purrr_0.3.5
## [5] readr_2.1.3 tidyr_1.2.1 tibble_3.1.8 ggplot2_3.4.0
## [9] tidyverse_1.3.2 psych_2.2.9 semPlot_1.1.6 semTools_0.5-6
## [13] lavaan_0.6-15
##
## loaded via a namespace (and not attached):
## [1] googledrive_2.0.0 minqa_1.2.5 colorspace_2.0-3
## [4] ellipsis_0.3.2 htmlTable_2.4.1 corpcor_1.6.10
## [7] base64enc_0.1-3 fs_1.5.2 rstudioapi_0.14
## [10] lubridate_1.9.0 fansi_1.0.3 xml2_1.3.3
## [13] splines_4.2.2 mnormt_2.1.1 cachem_1.0.6
## [16] knitr_1.43 glasso_1.11 Formula_1.2-5
## [19] jsonlite_1.8.2 nloptr_2.0.3 broom_1.0.1
## [22] cluster_2.1.4 dbplyr_2.2.1 png_0.1-8
## [25] compiler_4.2.2 httr_1.4.4 backports_1.4.1
## [28] assertthat_0.2.1 Matrix_1.5-1 fastmap_1.1.0
## [31] gargle_1.2.1 cli_3.4.1 htmltools_0.5.5
## [34] tools_4.2.2 igraph_1.4.3 OpenMx_2.21.8
## [37] coda_0.19-4 gtable_0.3.1 glue_1.6.2
## [40] reshape2_1.4.4 Rcpp_1.0.9 carData_3.0-5
## [43] cellranger_1.1.0 jquerylib_0.1.4 vctrs_0.5.1
## [46] nlme_3.1-160 lisrelToR_0.1.5 xfun_0.39
## [49] rvest_1.0.3 openxlsx_4.2.5.2 lme4_1.1-31
## [52] timechange_0.1.1 lifecycle_1.0.3 gtools_3.9.4
## [55] XML_3.99-0.14 googlesheets4_1.0.1 MASS_7.3-58.1
## [58] scales_1.2.1 hms_1.1.2 kutils_1.70
## [61] parallel_4.2.2 yaml_2.3.5 pbapply_1.7-0
## [64] gridExtra_2.3 sass_0.4.2 rpart_4.1.19
## [67] stringi_1.7.8 highr_0.9 sem_3.1-15
## [70] checkmate_2.1.0 boot_1.3-28 zip_2.3.0
## [73] rlang_1.0.6 pkgconfig_2.0.3 arm_1.13-1
## [76] evaluate_0.17 lattice_0.20-45 htmlwidgets_1.6.2
## [79] tidyselect_1.1.2 plyr_1.8.7 magrittr_2.0.3
## [82] R6_2.5.1 generics_0.1.3 Hmisc_5.0-1
## [85] DBI_1.1.3 withr_2.5.0 pillar_1.8.1
## [88] haven_2.5.1 foreign_0.8-84 rockchalk_1.8.157
## [91] abind_1.4-5 nnet_7.3-18 crayon_1.5.2
## [94] modelr_0.1.9 fdrtool_1.2.17 utf8_1.2.2
## [97] tzdb_0.3.0 rmarkdown_2.16 jpeg_0.1-10
## [100] readxl_1.4.1 grid_4.2.2 qgraph_1.9.4
## [103] data.table_1.14.2 pbivnorm_0.6.0 reprex_2.0.2
## [106] digest_0.6.29 xtable_1.8-4 mi_1.1
## [109] RcppParallel_5.1.7 stats4_4.2.2 munsell_0.5.0
## [112] bslib_0.4.0 quadprog_1.5-8
#Retrieving packages information for references
citation("lavaan")
##
## To cite lavaan in publications use:
##
## Yves Rosseel (2012). lavaan: An R Package for Structural Equation
## Modeling. Journal of Statistical Software, 48(2), 1-36.
## https://doi.org/10.18637/jss.v048.i02
##
## A BibTeX entry for LaTeX users is
##
## @Article{,
## title = {{lavaan}: An {R} Package for Structural Equation Modeling},
## author = {Yves Rosseel},
## journal = {Journal of Statistical Software},
## year = {2012},
## volume = {48},
## number = {2},
## pages = {1--36},
## doi = {10.18637/jss.v048.i02},
## }
citation("semPlot")
##
## To cite package 'semPlot' in publications use:
##
## Epskamp S (2022). _semPlot: Path Diagrams and Visual Analysis of
## Various SEM Packages' Output_. R package version 1.1.6,
## <https://CRAN.R-project.org/package=semPlot>.
##
## A BibTeX entry for LaTeX users is
##
## @Manual{,
## title = {semPlot: Path Diagrams and Visual Analysis of Various SEM Packages'
## Output},
## author = {Sacha Epskamp},
## year = {2022},
## note = {R package version 1.1.6},
## url = {https://CRAN.R-project.org/package=semPlot},
## }
citation("semTools")
##
## The maintainer and *primary* contributors to this package are listed as
## authors, but this package is a collaborative work. The maintainer(s)
## cannot take credit for others' contributions. Whenever possible, please
## cite the paper(s) associated with the development of a particular
## function (e.g., permuteMeasEq or parcelAllocation) or tutorials about
## how to use them (e.g., probe2WayMC and related functions), which are
## listed in the References section of its associated help page.
## Otherwise, please use the following citation for the package as a
## whole:
##
## Jorgensen, T. D., Pornprasertmanit, S., Schoemann, A. M., & Rosseel,
## Y. (2022). semTools: Useful tools for structural equation modeling. R
## package version 0.5-6. Retrieved from
## https://CRAN.R-project.org/package=semTools
##
## A BibTeX entry for LaTeX users is
##
## @Manual{,
## title = {\texttt{semTools}: {U}seful tools for structural equation modeling},
## author = {Terrence D. Jorgensen and Sunthud Pornprasertmanit and Alexander M. Schoemann and Yves Rosseel},
## year = {2022},
## note = {R package version 0.5-6},
## url = {https://CRAN.R-project.org/package=semTools},
## }
citation("psych")
##
## To cite the psych package in publications use:
##
## Revelle, W. (2022) psych: Procedures for Personality and
## Psychological Research, Northwestern University, Evanston, Illinois,
## USA, https://CRAN.R-project.org/package=psych Version = 2.2.9.
##
## A BibTeX entry for LaTeX users is
##
## @Manual{,
## title = {psych: Procedures for Psychological, Psychometric, and Personality Research},
## author = {William Revelle},
## organization = { Northwestern University},
## address = { Evanston, Illinois},
## year = {2022},
## note = {R package version 2.2.9},
## url = {https://CRAN.R-project.org/package=psych},
## }
citation("tidyverse")
##
## To cite package 'tidyverse' in publications use:
##
## Wickham H, Averick M, Bryan J, Chang W, McGowan LD, François R,
## Grolemund G, Hayes A, Henry L, Hester J, Kuhn M, Pedersen TL, Miller
## E, Bache SM, Müller K, Ooms J, Robinson D, Seidel DP, Spinu V,
## Takahashi K, Vaughan D, Wilke C, Woo K, Yutani H (2019). "Welcome to
## the tidyverse." _Journal of Open Source Software_, *4*(43), 1686.
## doi:10.21105/joss.01686 <https://doi.org/10.21105/joss.01686>.
##
## A BibTeX entry for LaTeX users is
##
## @Article{,
## title = {Welcome to the {tidyverse}},
## author = {Hadley Wickham and Mara Averick and Jennifer Bryan and Winston Chang and Lucy D'Agostino McGowan and Romain François and Garrett Grolemund and Alex Hayes and Lionel Henry and Jim Hester and Max Kuhn and Thomas Lin Pedersen and Evan Miller and Stephan Milton Bache and Kirill Müller and Jeroen Ooms and David Robinson and Dana Paige Seidel and Vitalie Spinu and Kohske Takahashi and Davis Vaughan and Claus Wilke and Kara Woo and Hiroaki Yutani},
## year = {2019},
## journal = {Journal of Open Source Software},
## volume = {4},
## number = {43},
## pages = {1686},
## doi = {10.21105/joss.01686},
## }