For my thesis I will use the bivariate latent change score model script from Kievit et al. (2019) to examine cross-domain coupling between a behavioural measure (COG) and a neural measure (NEU). As literature indicate clear gender/sex differences in both the behavioural measure and the neural measure I need to include gender either as a covariate or moderator. As I have to wait until the brain data has been processed, I don't know yet if gender needs to be included as a covariate or moderator, so I will built a script for both options.
Below an example of the simulated behavioural and neural data (adjusted from Kievit et al., (2019).
ID Gender COG_T2 NEU_T2 COG_T1 NEU_T1
1 1 1 76.22917 79.43908 53.20528 49.62215
2 2 1 66.36671 75.00343 49.30717 51.58633
3 3 0 66.48437 70.27303 49.86300 45.77009
4 4 0 77.75167 83.15892 55.53910 56.79443
5 5 0 71.70557 70.15355 49.94024 48.49120
6 6 0 66.85080 74.22823 50.59392 47.30940
7 7 0 70.00420 79.28115 49.02672 53.21601
8 8 0 71.91539 75.66060 52.97894 51.61178
9 9 1 71.94721 76.55157 52.68766 50.77945
10 10 1 72.88224 77.77361 52.23488 53.01573
Below the script adjusted form Kievit et al. (2019) without taking into account gender.
#Fix sample size
samplesize<-500
#Fit the Bivariate Latent Change Score model to simulated data
BLCS<-'
COG_T2 ~ 1*COG_T1 # This parameter regresses COG_T2 perfectly on COG_T1
dCOG1 =~ 1*COG_T2 # This defines the latent change score factor as measured perfectly by scores on COG_T2
dCOG1 ~ 1 # This estimates the intercept of the change score
COG_T1 ~ 1 # This estimates the intercept of COG_T1
COG_T2 ~ 0*1 # This constrains the intercept of COG_T2 to 0
NEU_T2 ~ 1*NEU_T1 # This parameter regresses NEU_T2 perfectly on NEU_T1
dNEU1 =~ 1*NEU_T2 # This defines the latent change score factor as measured perfectly by scores on NEU_T2
NEU_T2 ~ 0*1 # This line constrains the intercept of NEU_T2 to 0
NEU_T2 ~~ 0*NEU_T2 # This fixes the variance of the NEU_T1 to 0
dCOG1 ~~ dCOG1 # This estimates the variance of the change scores
COG_T1 ~~ COG_T1 # This estimates the variance of the COG_T1
COG_T2 ~~ 0*COG_T2 # This fixes the variance of the COG_T2 to 0
dNEU1 ~ 1 # This estimates the intercept of the change score
NEU_T1 ~ 1 # This estimates the intercept of NEU_T1
dNEU1 ~~ dNEU1 # This estimates the variance of the change scores
NEU_T1 ~~ NEU_T1 # This estimates the variance of NEU_T1
dNEU1~COG_T1+NEU_T1 # This estimates the COG to NEU coupling parameter and the COG to COG self-feedback
dCOG1~NEU_T1+COG_T1 # This estimates the NEU to COG coupling parameter and the NEU to NEU self-feedback
COG_T1 ~~ NEU_T1 # This estimates the COG_T1 NEU_T1 covariance
dCOG1~~dNEU1 # This estimates the dCOG and dNEU covariance
'
fitBLCS <- lavaan(BLCS, data=test_data, estimator='mlr',fixed.x=FALSE,missing='fiml')
I added Gender as covariate/moderator in the model like this:
COG_T2 ~ 1*COG_T1 + Gender + (COG_T1*Gender)
NEU_T2 ~ 1*NEU_T1 + Gender + (NEU_T1*Gender)
Gender ~ 1
This resulted in the following error:
> fitBLCS <- lavaan(BLCS, data=test_data, estimator='mlr',fixed.x=FALSE,missing='fiml')
Error in lav_model_estimate(lavmodel = lavmodel, lavpartable = lavpartable, :
lavaan ERROR: initial model-implied matrix (Sigma) is not positive definite;
check your model and/or starting parameters.
Can someone explain me how I can correctly include gender as covariate/cover in this BLCS model?
Kind regards,
Vibeke Nielsen