svyfactanal.Rd
This function fits a factor analysis model or SEM, by maximum weighted likelihood.
svyfactanal(formula, design, factors,
n = c("none", "sample", "degf","effective", "min.effective"), ...)
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 factanal
.
The population covariance matrix is estimated by svyvar
and passed to factanal
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 degf
. Using "sample"
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
estimated by svyvar
. With n="min.effective"
the
minimum sample size across the variables is used; with
n="effective"
the harmonic mean is used. For svyfactanal
the test of model adequacy is optional, and the default choice,
n="none"
, does not do the test.
An object of class factanal
.
The lavaan.survey
package fits structural equation models to complex samples using similar techniques.
data(api)
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
svyfactanal(~api99+api00+hsg+meals+ell+emer, design=dclus1, factors=2)
#>
#> Call:
#> svyfactanal(~api99 + api00 + hsg + meals + ell + emer, design = dclus1, factors = 2)
#>
#> Uniquenesses:
#> api99 api00 hsg meals ell emer
#> 0.009 0.058 0.978 0.230 0.005 0.865
#>
#> Loadings:
#> Factor1 Factor2
#> api99 -0.990 0.108
#> api00 -0.959 0.151
#> hsg -0.143
#> meals 0.877
#> ell 0.727 0.683
#> emer 0.367
#>
#> Factor1 Factor2
#> SS loadings 3.333 0.521
#> Proportion Var 0.556 0.087
#> Cumulative Var 0.556 0.642
#>
#> The degrees of freedom for the model is 4 and the fit was 0.0898
svyfactanal(~api99+api00+hsg+meals+ell+emer, design=dclus1, factors=2, n="effective")
#>
#> Call:
#> svyfactanal(~api99 + api00 + hsg + meals + ell + emer, design = dclus1, factors = 2, n = "effective")
#>
#> Uniquenesses:
#> api99 api00 hsg meals ell emer
#> 0.009 0.058 0.978 0.230 0.005 0.865
#>
#> Loadings:
#> Factor1 Factor2
#> api99 -0.990 0.108
#> api00 -0.959 0.151
#> hsg -0.143
#> meals 0.877
#> ell 0.727 0.683
#> emer 0.367
#>
#> Factor1 Factor2
#> SS loadings 3.333 0.521
#> Proportion Var 0.556 0.087
#> Cumulative Var 0.556 0.642
#>
#> Test of the hypothesis that 2 factors are sufficient.
#> The chi square statistic is 2.94 on 4 degrees of freedom.
#> The p-value is 0.567
##Population dat for comparison
factanal(~api99+api00+hsg+meals+ell+emer, data=apipop, factors=2)
#>
#> Call:
#> factanal(x = ~api99 + api00 + hsg + meals + ell + emer, factors = 2, data = apipop)
#>
#> Uniquenesses:
#> api99 api00 hsg meals ell emer
#> 0.024 0.023 0.799 0.005 0.392 0.732
#>
#> Loadings:
#> Factor1 Factor2
#> api99 0.839 -0.522
#> api00 0.864 -0.480
#> hsg -0.272 0.357
#> meals -0.471 0.879
#> ell -0.468 0.623
#> emer -0.433 0.284
#>
#> Factor1 Factor2
#> SS loadings 2.152 1.872
#> Proportion Var 0.359 0.312
#> Cumulative Var 0.359 0.671
#>
#> Test of the hypothesis that 2 factors are sufficient.
#> The chi square statistic is 580.89 on 4 degrees of freedom.
#> The p-value is 2.12e-124