poLCA_result: Useful short cut for 'poLCA::poLCA'.

View source: R/poLCA_result.R

poLCA_resultR Documentation

Useful short cut for poLCA::poLCA.

Description

you get a result table for reporting with the other functions like poLCA_check_class or poLCA_BLRT.

Usage

poLCA_result(
  formula,
  data,
  nclass,
  maxiter = 5000,
  nrep = 1,
  reorder_with = "class prop",
  reorder_outcome = 1,
  reorder_decreasing = TRUE,
  verbose = TRUE
)

Arguments

formula

a formula object directly passed to poLCA::poLCA.

data

a data frame.

nclass

a numeric vector of number of latent class to estimate. For example, if you want to estimate 2 class model to 5 class model for comparing model fitting of them, input nclass = 2:5.

maxiter

The maximum number of iterations through which the estimation algorithm will cycle.

nrep

Number of times to estimate the model, using different values of probs.start. The default is one. Setting nrep>1 automates the search for the global—rather than just a local—maximum of the log-likelihood function. poLCA returns the parameter estimates corresponding to the model with the greatest log-likelihood.

reorder_with

'class_prop' or one variable name. If 'class_prop', the order of latent class is determined by the proportion of each class. If one variable name, the order of latent class is determined by the conditional probability of the variable. The default is 'class_prop'.

reorder_outcome

a numeric value of a category of manifest variable. You can reorder latent classes with reference to the category of manifest variable. You must specify a manifest variable in reorder_with argment. The default is 1.

See Also

poLCA::poLCA()

Examples

# example data
data('carcinoma', package = 'poLCA')

# estimate 2 class model to 3 class model
result <- poLCA_result(
  formula = as.matrix(carcinoma) ~ 1,
  data = carcinoma,
  nclass = 2:3,
  maxiter = 6000,
  nrep = 1,
  verbose = TRUE
)


Sickle-Sword/kamaken documentation built on Feb. 2, 2025, 2:56 a.m.