library(NlsyLinks) # Load the package into the current R session.
dsLinks <- Links79PairExpanded # Start with the built-in data.frame in NlsyLinks
dsLinks <- dsLinks[dsLinks$RelationshipPath == "Gen2Siblings", ] # Use only Gen2 Siblings (NLSY79-C)
oName_S1 <- "MathStandardized_S1" # Stands for Outcome1
oName_S2 <- "MathStandardized_S2" # Stands for Outcome2
dsGroupSummary <- RGroupSummary(dsLinks, oName_S1, oName_S2)
dsClean <- CleanSemAceDataset(dsDirty = dsLinks, dsGroupSummary, oName_S1, oName_S2)
ace <- AceLavaanGroup(dsClean)
ace
# Should produce:
# [1] "Results of ACE estimation: [show]"
# ASquared CSquared ESquared CaseCount
# 0.6681874 0.1181227 0.2136900 8390.0000000
library(lavaan) # Load the package to access methods of the lavaan class.
GetDetails(ace)
# Exmaine fit stats like Chi-Squared, RMSEA, CFI, etc.
fitMeasures(GetDetails(ace)) # The function 'fitMeasures' is defined in the lavaan package.
# Examine low-level details like each group's individual parameter estimates and standard errors.
summary(GetDetails(ace))
# Extract low-level details. This may be useful when programming simulations.
inspect(GetDetails(ace), what = "converged") # The lavaan package defines 'inspect'.
inspect(GetDetails(ace), what = "coef")
Run the code above in your browser using DataLab