Learn R Programming

slca (version 1.3.0)

estimate: Estimate Parameters of an slca Object

Description

Estimates the parameters of a model created using the slca function.

Usage

estimate(x, ...)

# S3 method for slca estimate(x, data, method = c("em", "hybrid", "nlm"), fix2zero = NULL, control = slcaControl(), ...)

Value

An object of class slcafit containing the following components:

model

a list describing of the model structure.

method

the estimation method used.

arg

a brief description of the model used during estimation.

mf

the data.frame used for estimation.

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 list of posterior probablities for each latent class variable.

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.

Arguments

x

an slca object defining the slca model to be estimated.

...

additional arguments passed to the estimation process.

data

a data.frame containing the observed categorical variables included in the model.

method

a character string specifying the estimation method for SLCM parameters. The default is "em", which uses the expectation-maximization (EM) algorithm. The alternative "nlm" employs the Newton-Raphson algorithm via the nlm function, while "hybrid" combines both approaches, starting with EM and finishing with nlm for refined estimates.

fix2zero

a vector specifying parameters to be constrained to zero. See the 'Details' section for further information.

control

a list of control parameters for the estimation procedure. Modify default values using slcaControl().

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.

See Also

slca() param() slcaControl()

Examples

Run this code
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)))

Run the code above in your browser using DataLab