Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/ace-lavaan-group.R

This function uses the lavaan package to estimate a univariate ACE model, using multiple groups.
Each group has a unique value of `R`

(i.e., the *R*elatedness coefficient).

1 | ```
AceLavaanGroup(dsClean, estimateA=TRUE, estimateC=TRUE, printOutput=FALSE)
``` |

`dsClean` |
The |

`estimateA` |
Should the |

`estimateC` |
Should the |

`printOutput` |
Indicates if the estimated parameters and fit statistics are printed to the console. |

The variance component for *E* is always estimated, while the *A* and *C* estimates can be fixed to zero (when `estimateA`

and/or *estimateC* are set to `FALSE`

).

An `AceEstimate`

object.

Currently, the variables in `dsClean`

must be named `O1`

, `O2`

and `R`

; the letter ‘O’ stands for *O*utcome. This may not be as restrictive as it initially seems, because `dsClean`

is intented to be produced by `CleanSemAceDataset`

. If this is too restrictive for your uses, we'd like to here about it (*please email wibeasley at hotmail period com*).

Will Beasley

The lavaan package is developed by Yves Rosseel at Ghent University. Three good starting points are the package home page (http://lavaan.ugent.be/), the documentation (http://cran.r-project.org/package=lavaan) and the JSS paper.

Rosseel, Yves (2012), lavaan: An R Package for Structural Equation Modeling. *Journal of Statistical Software, 48*, (2), 1-36.

`CleanSemAceDataset`

. Further ACE model details are discussed in our package's vignettes.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
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")
``` |

NlsyLinks documentation built on May 29, 2017, 3:55 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.