This function fits a factor analysis model or SEM, by maximum weighted likelihood.
Model formula specifying the variables to use
Survey design object
Number of factors to estimate
Sample size to be used for testing: see below
Other arguments to pass to
The population covariance matrix is estimated by
and passed to
Although fitting these models requires only the estimated covariance
matrix, inference requires a sample size. With
n="sample", the sample size is taken to be
the number of observations; with
n="degf", the survey degrees of
freedom as returned by
corresponds to standardizing weights to have mean 1, and is known to
result in anti-conservative tests.
The other two methods estimate an effective sample size for each
variable as the sample size where the standard error of a variance of a
Normal distribution would match the design-based standard error
minimum sample size across the variables is used; with
n="effective" the harmonic mean is used. For
the test of model adequacy is optional, and the default choice,
n="none", does not do the test.
An object of class
lavaan.survey package fits structural equation models to complex samples using similar techniques.
1 2 3 4 5 6 7 8 9
data(api) dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) svyfactanal(~api99+api00+hsg+meals+ell+emer, design=dclus1, factors=2) svyfactanal(~api99+api00+hsg+meals+ell+emer, design=dclus1, factors=2, n="effective") ##Population dat for comparison factanal(~api99+api00+hsg+meals+ell+emer, data=apipop, factors=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.