Hi guys, for my master's thesis, I have to do a SEM.
I've got longitudinal data from 150 babys and their mothers at 3 time points.
My first aim is to observe how maternal cognitions (measured by 3 questionnaire scales anger, doubt and limit setting), maternal sleep (measured by 3 questionnaire items, 2 items for waking up and 1 for sleep duration) and the baby's sleep (measured by motion detection: nightwakings, sleep duration day and total sleep duration) is connected at each time point, supposing that there's a direct and indirect effect of maternal cognitions on baby's sleep (indirect over maternal sleep). Also, i'd like to observe if maternal cognitons and sleep at time points 1 and 2 can predict baby's sleep at time points 2 and 3.
My second aim is to observe if stress during pregnancy (measured by a stress questionnaire) can predict baby's sleep (nightwakings, sleep duration day, total sleep duration and co-sleeping) at time points 1, 2 and 3.
I've tried to model each time point seperately and the predictions as well in a different model, bc it also didn't work all in one, maybe bc it's too much to handle for lavaan with such a small sample? However, when I try to fit the models, I always get the following warning message, also when I try to fit the predictions and stress during pregnancy separately:
lavaan WARNING: the optimizer warns that a solution has NOT been found!
Here's my R-Code:
ModelT1 <- '
SleepBaby_T1 =~ T1_Nightwakings_z + T1_SleepDurationDay_z + T1_SleepDurationWhole_z
SleepBabyStressPreg_T1 =~ T1_Nightwakings_z + T1_SleepDurationDay_z + T1_SleepDurationWhole_z +CoSleeping_T1_z
SleepMother_T1 =~ T1_SleepDuration_z + T1_WakingUp_z
CogMother_T1 =~ LimitSetting_T1_z + Anger_T1_z + Doubt_T1_z
StressPreg=~ PSQ_Total_Score_z
SleepBaby_T1 ~ SchlafKm_T1 + KogKm_T1
SleepMother_T1 ~ KogKm_T1
SleepBabyStressPreg_T1 ~ StressPreg
'
fit1 <- sem(ModellT1, data=IMPDATA, fixed.x=FALSE, missing="fiml", estimator="mlr")
summary(fit1, fit.measures=T)
ModelT2 <- '
SleepBaby_T2 =~ T2_Nightwakings_z + T2_SleepDurationDay_z + T2_SleepDurationWhole_z
SleepBabyStressPreg_T2 =~ T2_Nightwakings_z + T2_SleepDurationDay_z + T2_SleepDurationWhole_z +CoSleeping_T2_z
SleepMother_T2 =~ T2_SleepDuration_z + T2_WakingUp_z
CogMother_T2 =~ LimitSetting_T2_z + Anger_T2_z + Doubt_T2_z
StressPreg=~ PSQ_Total_Score_z
SleepBaby_T2 ~ SleepMother_T2 + CogMother_T2
SleepMother_T2 ~ CogMother_T2
SleepBabyStressPreg_T2 ~ StressPreg
'
fit2 <- sem(ModellT2, data=IMPDATA, fixed.x=FALSE, missing="fiml", estimator="mlr")
summary(fit2, fit.measures=T)
ModelT3 <- '
SleepBaby_T3 =~ T3_Nightwakings_z + T3_SleepDurationDay_z + T3_SleepDurationWhole_z
SleepBabyStressPreg_T3 =~ T3_Nightwakings_z + T3_SleepDurationDay_z + T3_SleepDurationWhole_z +CoSleeping_Ja_T3_z
SleepMother_T3 =~ T3_SleepDuration_z + T3_WakingUp_z
CogMother_T3 =~ LimitSetting_T3_z + Anger_T3_z + Doubt_T3_z
StressPreg=~ PSQ_Total_Score_z
SleepBaby_T3 ~ SleepMother_T3 + CogMother_T3
SleepBaby_T3 ~ CogMother_T3
SleepBabyStressPreg_T3 ~ StressPreg
'
fit3 <- sem(ModellT3, data=IMPDATA, fixed.x=FALSE, missing="fiml", estimator="mlr")
summary(fit3, fit.measures=T)
Model_StressPreg<- '
SleepBabyStressPreg_T1 =~ T1_Nightwakings_z + T1_SleepDurationDay_z + T1_SleepDurationWhole_z +CoSleeping_Ja_T1_z
SleepBabyStressPreg_T2 =~ T2_Nightwakings_z + T2_SleepDurationDay_z + T2_SleepDurationWhole_z +CoSleeping_Ja_T2_z
SleepBabyStressPreg_T3 =~ T3_Nightwakings_z + T3_SleepDurationDay_z + T3_SleepDurationWhole_z +CoSleeping_Ja_T3_z
StressPreg=~ PSQ_Total_Score_z
SleepBabyStressPreg_T1 ~ StressPreg
SleepBabyStressPreg_T2 ~ StressPreg
SleepBabyStressPreg_T3 ~ StressPreg
'
fitStress <- sem(Model_StressPreg, data=IMPDATA, fixed.x=FALSE, missing="fiml", estimator="mlr")
summary(fitStress, fit.measures=T)
ModelPredictions <- '
SleepBaby_T2 =~ T2_Nightwakings_z + T2_SleepDurationDay_z + T2_SleepDurationWhole_z
SleepBaby_T3 =~ T3_Nightwakings_z + T3_SleepDurationDay_z + T3_SleepDurationWhole_z
SleepMother_T1 =~ T1_SleepDuration_z + T1_WakingUp_z
CogMother_T1 =~ LimitSetting_T2_z + Anger_T1_z + Doubt_T1_z
SleepMother_T2 =~ T2_SleepDuration_z + T2_WakingUp_z
CogMother_T2 =~ LimitSetting_T2_z + Anger_T2_z + Doubt_T2_z
SleepBaby_T2 ~ SleepMother_T1 + CogMother_T1
SleepBaby_T3 ~ SleepMother_T1 + CogMother_T1 + SleepMother_T2 + CogMother_T2
'
fitPredic <- sem(ModelPredictions, data=IMPDATA, fixed.x=FALSE, missing="fiml", estimator="mlr")
summary(fitPredic, fit.measures=T)
Does anyone know what I am doing wrong or have suggestions how I can handle this better? I'd be glad if your explications would be as simple as possible bc I am a beginner. Thank you!