####################################################### #----------------------------------------------------- # fit and compare models #----------------------------------------------------- ####################################################### # fit Saturated model fitSATURATEDmodel <- mxRun(SATURATEDmodel) summary(fitSATURATEDmodel) mxEval(Saturated.cormz,fitSATURATEDmodel) mxEval(Saturated.cordz,fitSATURATEDmodel) #---------------------------------------------------- # FIT 0 GEcovSIMPLEX with all parameters in place #---------------------------------------------------- fitGEcovSIMPLEX <- mxRun(GEcovSIMPLEXmodel) summary(fitGEcovSIMPLEX) fit0=cbind(round(fitGEcovSIMPLEX@output$estimate,3),round(fitGEcovSIMPLEX@output$standardErrors,3))# mxCompare(fitSATURATEDmodel,fitGEcovSIMPLEX) # conclusion: ? # From here on forward, we are going to drop parameters to replicate the findings in our Flynn effect paper. # We will give you the label names of the parameters to be dropped. # TASK: # [1] adapt the code such that the parameters are dropped using the function: omxSetParameters #---------------------------------------------------- # FIT 1 GEcovSIMPLEX with dropping the time specific a #---------------------------------------------------- # drop parameter of time specific additive genetic variance # labels is 'ar' GEcovSIMPLEXmodel_1 = omxSetParameters(GEcovSIMPLEXmodel, labels=c('ar'), free = c(FALSE), values = c(0)) fitGEcovSIMPLEX_1 <- mxRun(GEcovSIMPLEXmodel_1) summary(fitGEcovSIMPLEX_1) mxCompare(fitGEcovSIMPLEX,fitGEcovSIMPLEX_1) # conclusion: ? #---------------------------------------------------- # FIT 2 GEcovSIMPLEX #---------------------------------------------------- # drop transmission in E # labels are 'be1','be2','be3' GEcovSIMPLEXmodel_2 = omxSetParameters(GEcovSIMPLEXmodel_1, labels=c('be1','be2','be3'), free = c(FALSE), values = c(0)) fitGEcovSIMPLEX_2 <- mxRun(GEcovSIMPLEXmodel_2) summary(fitGEcovSIMPLEX_2) mxCompare(fitGEcovSIMPLEX_1,fitGEcovSIMPLEX_2) # conclusion: ? #---------------------------------------------------- # FIT 3 GEcovSIMPLEX #---------------------------------------------------- # drop innovation of additive genetic variance in A # labels are 'va3','va4' GEcovSIMPLEXmodel_3 = omxSetParameters(GEcovSIMPLEXmodel_2, labels=c('va3','va4'), free = c(FALSE), values = c(0)) fitGEcovSIMPLEX_3 <- mxRun(GEcovSIMPLEXmodel_3) summary(fitGEcovSIMPLEX_3) mxCompare(fitGEcovSIMPLEX_2,fitGEcovSIMPLEX_3) # conclusion: ? #---------------------------------------------------- # FIT 4 GEcovSIMPLEX #---------------------------------------------------- # drop covariance in E # labels are 'cee2','cee3','cee4' GEcovSIMPLEXmodel_4 = omxSetParameters(GEcovSIMPLEXmodel_3, labels=c('cee2','cee3','cee4'), free = c(FALSE), values = c(0)) fitGEcovSIMPLEX_4 <- mxRun(GEcovSIMPLEXmodel_4) summary(fitGEcovSIMPLEX_4) mxCompare(fitGEcovSIMPLEX_3,fitGEcovSIMPLEX_4) # conclusion: ? #---------------------------------------------------- # FIT 5 GEcovSIMPLEX #---------------------------------------------------- # set transmission in A equal # labels are 'ba1','ba2','ba3' GEcovSIMPLEXmodel_5 = omxSetParameters(GEcovSIMPLEXmodel_4, labels=c('ba1','ba2','ba3'), newlabels=c('ba1','ba1','ba1'), free = c(T), values = c(.8)) fitGEcovSIMPLEX_5 <- mxRun(GEcovSIMPLEXmodel_5) summary(fitGEcovSIMPLEX_5) mxCompare(fitGEcovSIMPLEX_4,fitGEcovSIMPLEX_5) # conclusion: ? #---------------------------------------------------- # FIT 6 GEcovSIMPLEX #---------------------------------------------------- # test if ph->e can be dropped # labels are 'ph_e1w','ph_e1b' GEcovSIMPLEXmodel_6 = omxSetParameters(GEcovSIMPLEXmodel_5, labels=c('ph_e1w','ph_e1b'), free = c(F), values = c(.0)) fitGEcovSIMPLEX_6 <- mxRun(GEcovSIMPLEXmodel_6) mxCompare(fitGEcovSIMPLEX_5,fitGEcovSIMPLEX_6) # conclusion: ? #---------------------------------------------------- # Final comparison #---------------------------------------------------- # Return to the last fitting model # does the final model fit # mxCompare(fitSATURATEDmodel,fitGEcovSIMPLEX_5)