lca_segmentation: Runs Latent Class Analysis using the poLCA package.

View source: R/lca_segmentation.R

lca_segmentationR Documentation

Runs Latent Class Analysis using the poLCA package.

Description

Runs Latent Class Analysis using the poLCA package.

Usage

lca_segmentation(
  df,
  vars,
  num_sols,
  maxiter = 1000,
  tol = 1e-10,
  na.rm = TRUE,
  nrep = 1
)

Arguments

df

data.frame of numeric variables.

vars

variables to be used in the latent class analysis.

num_sols

number of segment solutions to run.

maxiter

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

tol

tolerance value for judging when convergence has been reached. When the one-iteration change in the estimated log-likelihood is less than tol, the estimation algorithm stops updating and considers the maximum log-likelihood to have been found.

na.rm

Logical, for how poLCA handles cases with missing values on the manifest variables. If TRUE, those cases are removed (listwise deleted) before estimating the model. If FALSE, cases with missing values are retained. Cases with missing covariates are always removed. The default is TRUE.

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.

#' @examples df <- rsegmenter::test_seg_unlabelled segment_input_vars <- c("seg1","seg2","seg3","seg4","seg5","seg6","seg7","seg8","seg9","seg10") lca_segmentation(df = df, vars = segment_input_vars, num_sols=c(2:3))


PrenolanM/rsegmenter documentation built on Aug. 7, 2022, 8:56 p.m.