bcfa {blavaan} | R Documentation |
Fit Confirmatory Factor Analysis Models
Description
Fit a Confirmatory Factor Analysis (CFA) model.
Usage
bcfa(..., cp = "srs",
dp = NULL, n.chains = 3, burnin, sample,
adapt, mcmcfile = FALSE, mcmcextra = list(), inits = "simple",
convergence = "manual", target = "stan", save.lvs = FALSE,
wiggle = NULL, wiggle.sd = 0.1, prisamp = FALSE, jags.ic = FALSE,
seed = NULL, bcontrol = list())
Arguments
... |
Default lavaan arguments. See |
cp |
Handling of prior distributions on covariance parameters:
possible values are |
dp |
Default prior distributions on different types of
parameters, typically the result of a call to |
n.chains |
Number of desired MCMC chains. |
burnin |
Number of burnin/warmup iterations (not including the adaptive iterations, for target="jags"). Defaults to 4000 or target="jags" and 500 for Stan targets. |
sample |
The total number of samples to take after burnin. Defaults to 10000 for target="jags" and 1000 for Stan targets. |
adapt |
For target="jags", the number of adaptive iterations to use at the start of sampling. Defaults to 1000. |
mcmcfile |
If |
mcmcextra |
A list with potential names |
inits |
If it is a character string, the options are currently
|
convergence |
Useful only for |
target |
Desired MCMC sampling, with |
save.lvs |
Should sampled latent variables (factor scores) be saved? Logical; defaults to FALSE |
wiggle |
Labels of equality-constrained parameters that should be "approximately" equal. Can also be "intercepts", "loadings", "regressions", "means". |
wiggle.sd |
The prior sd (of normal distribution) to be used in approximate equality constraints. Can be one value, or (for target="stan") a numeric vector of values that is the same length as wiggle. |
prisamp |
Should samples be drawn from the prior, instead of the
posterior ( |
jags.ic |
Should DIC be computed the JAGS way, in addition to the BUGS way? Logical; defaults to FALSE |
seed |
A vector of length |
bcontrol |
A list containing additional parameters passed to
|
Details
The bcfa
function is a wrapper for the more general
blavaan
function, using the following default
lavaan
arguments:
int.ov.free = TRUE
, int.lv.free = FALSE
,
auto.fix.first = TRUE
(unless std.lv = TRUE
),
auto.fix.single = TRUE
, auto.var = TRUE
,
auto.cov.lv.x = TRUE
,
auto.th = TRUE
, auto.delta = TRUE
,
and auto.cov.y = TRUE
.
Value
An object of class lavaan
, for which several methods
are available, including a summary
method.
References
Edgar C. Merkle, Ellen Fitzsimmons, James Uanhoro, & Ben Goodrich (2021). Efficient Bayesian Structural Equation Modeling in Stan. Journal of Statistical Software, 100(6), 1-22. URL http://www.jstatsoft.org/v100/i06/.
Edgar C. Merkle & Yves Rosseel (2018). blavaan: Bayesian Structural Equation Models via Parameter Expansion. Journal of Statistical Software, 85(4), 1-30. URL http://www.jstatsoft.org/v85/i04/.
Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36. URL http://www.jstatsoft.org/v48/i02/.
See Also
Examples
data(HolzingerSwineford1939, package = "lavaan")
# The Holzinger and Swineford (1939) example
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
## Not run:
fit <- bcfa(HS.model, data = HolzingerSwineford1939)
summary(fit)
## End(Not run)
# A short run for rough results
fit <- bcfa(HS.model, data = HolzingerSwineford1939, burnin = 100, sample = 100,
n.chains = 2)
summary(fit)