estimate {slca} | R Documentation |
Estimate Parameters of an slca
Object
Description
Estimates the parameters of a model created using the slca
function.
Usage
estimate(x, ...)
## S3 method for class 'slca'
estimate(x,
data,
method = c("em", "hybrid", "nlm"),
fix2zero = NULL,
control = slcaControl(), ...)
Arguments
x |
an |
... |
additional arguments passed to the estimation process. |
data |
a |
method |
a character string specifying the estimation method for SLCM parameters. The default is |
fix2zero |
a |
control |
a |
Details
The fix2zero
argument allows you to constrain specific parameters to zero. Each parameter is associated with a unique index, which can be identified using the param function with the argument index = TRUE
. To apply constraints, provide the relevant parameter indices in the fix2zero
arguments with vector.
Value
An object of class slcafit
containing the following components:
model |
a |
method |
the estimation method used. |
arg |
a brief description of the model used during estimation. |
mf |
the |
par |
the log of the estimated paramters. |
logit |
the log-odds of the estimated parameters. |
score |
the score function for the estimated parameters. |
posterior |
a |
convergence |
a logical indicator of whether convergence was achieved. |
loglikelihood |
the loglikelihood value of the estimated model. |
control |
the control settings used during the estimation process. |
The returned object can be further processed using the param function to extract the estimated parameters or their standard errors. The regress function allows for logistic regression analysis using a three-step approach to evaluate the effects of external variables on latent class variables. Additionally, several other methods are available, including predict.slcafit, reorder.slcafit, gof, and others.
See Also
Examples
m <- slca(lc[3] ~ y1 + y2 + y3 + y4)
pi <- rep(1 / 3, 3)
rho <- c(.9, .1, .9, .1, .9, .1, .9, .1, # class 1
.9, .1, .9, .1, .1, .9, .1, .9, # class 2
.1, .9, .1, .9, .1, .9, .1, .9) # class 3
dt <- simulate(m, 200, parm = c(pi, rho))
estimate(m, dt$response)
# Several estimation methods
estimate(m, dt$response, method = "em",
control = slcaControl(verbose = TRUE)) # default
estimate(m, dt$response, method = "nlm",
control = slcaControl(verbose = TRUE))
estimate(m, dt$response, method = "hybrid",
control = slcaControl(verbose = TRUE))
# Parameter restriction
mf <- estimate(m, dt$response)
param(mf, index = TRUE)
mf0 <- estimate(mf, fix2zero = c(4, 6, 8, 10))
param(mf0)
# Estimation control
estimate(m, dt$response, control = slcaControl(nrep = 3, verbose = TRUE))
estimate(m, dt$response, control = slcaControl(init.param = c(pi, rho)))