Learn R Programming

randomLCA (version 1.1-4)

outcomeProbs: Extract outcome probabilities for randomLCA object

Description

Extract outcome probabilities and confidence intervals for a randomLCA object.

Usage

# S3 method for randomLCA
outcomeProbs(object, level = 0.95, boot=FALSE, type="perc", R=999,
    scale=c("prob","raw"), cores = max(detectCores() %/% 2, 1), ...)

Value

Data frame consisting of outcome probabilities and confidence intervals. One for each class.

Arguments

object

randomLCA object

level

confidence interval

boot

use parametric bootstrap to obtain confidence interval

type

type of bootstrap confidence intervals to use, with "perc" or "norm" valid, see boot.ci for description.

R

replications for parametric bootstrap

scale

either "prob" where probabilities are returned, the default, or "raw" where the probabilities are returned on the logit or probit scale, depending on which scale was selected in the randomLCA function

cores

number of cores to use when bootstrapping, shuld be at least 1 less than available cores

...

additional argument; currently none is used.

Author

Ken Beath

Details

Confidence intervals are calculated based on asymptotic normality of the estimates transformed by either the inverse of the probit or logistic, or using parametric bootstrap. The asymptotic confidence intervals are currently only available for models without random effects. For the confidence intervals obtained from the parametric bootstrap, the bootstrap is performed on the data that has been transformed to the logit or probit scale, as appropriate.

Examples

Run this code
# \donttest{
# standard latent class with 2 classes
dentistry.lca2 <- randomLCA(dentistry[, 1:5], freq = dentistry$freq, nclass = 2, cores = 1)
print(outcomeProbs(dentistry.lca2))
# print on the default logit scale
print(outcomeProbs(dentistry.lca2, scale = "raw"))
# convert back to probabilities
print(1.0/(1.0+exp(-outcomeProbs(dentistry.lca2, scale = "raw")[[1]])))
print(1.0/(1.0+exp(-outcomeProbs(dentistry.lca2, scale = "raw")[[2]])))
# }

Run the code above in your browser using DataLab