Learn R Programming

nlsem (version 0.8-1)

qml: Quasi-maximum likelihood estimation of a nonlinear structural equation model

Description

Fits a structural equation model with latent interaction effects using Quasi-maximum likelihood estimation.

Usage

qml(model, data, start, max.iter = 150, optimizer = c("nlminb",
      "optim"), neg.hessian = TRUE, ...)

Value

An object of class qmlEst that consists of the following components:

model.class

class of model that was fitted. Will always be singleClass.

coefficients

estimated parameters.

objective

final loglikelihood obtained with EM algorithm.

convergence

convergence code for optimizer. See documentation for optim and nlminb.

Hessian

negative Hessian matrix for final parameter estimation.

info

list of number of exogenous (num.xi) and endogenous (num.eta) variables and of indicators (num.x and num.y). Corresponds to specifications given to specify_sem when specifiying structural equation model.

Arguments

model

a specified structural equation model of class singleClass.

data

the data the model should be fitted to. Data needs to be a matrix and variables need to be in the order x1, x2, ..., y1, y2, ... as specified in specify_sem. Data matrix needs no column names (will be ignored anyways).

start

starting values for parameters.

max.iter

maximum number of iterations for optimizer.

optimizer

which optimizer should be used for maximization of parameters: nlminb or optim.

neg.hessian

should negative Hessian be calculated.

...

additional arguments. See Details.

Details

Additional arguments can be passed to ... for these optimizers. See documentation for optim and nlminb.

Quasi-maximum likelihood (QML) estimation is in principle a faster version for LMS, but might be less accurate for normal data. For practical purposes differences are negligible, though. For nonnormal data QML outperforms LMS.

References

Klein, A. &, Muthen, B. O. (2007). Quasi-Maximum Likelihood Estimation of Structural Equation Models With Multiple Interaction and Quadratic Effects. Multivariate Behavior Research, 42, 647--673. doi:http://dx.doi.org/10.1080/00273170701710205

See Also

specify_sem

Examples

Run this code
# specify model of class singleClass
sc <- specify_sem(num.x=4, num.y=2, num.xi=2, num.eta=1, xi="x1-x2,x3-x4",
                  eta="y1-y2", interaction="eta1~xi1:xi2") 

# simulate data
pars.orig <- c(0.6, 0.7,                 # Lx
               0.8,                      # Ly
               0.2, 0.4,                 # G
               0.25, 0.25, 0.25, 0.25,   # Td
               0.25, 0.25,               # Te
               0.2,                      # Psi
               0.49, 0.235, 0.64,        # Phi
               0, 0,                     # nu.x
               0,                        # nu.x
               1,                        # alpha
               1, 1,                     # tau
               0.7                       # Omega
              )

dat <- simulate(sc, parameters=pars.orig, seed=81)

# fit model
set.seed(1609)
start <- runif(count_free_parameters(sc))
if (FALSE) {
qml1 <- qml(sc, dat, start)
summary(qml1)
}

Run the code above in your browser using DataLab