outcomeProbs: Extract outcome probabilities for randomLCA object

View source: R/outcomeProbs.R

outcomeProbsR Documentation

Extract outcome probabilities for randomLCA object

Description

Extract outcome probabilities and confidence intervals for a randomLCA object.

Usage

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

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 textttrandomLCA function

cores

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

...

additional argument; currently none is used.

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.

Value

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

Author(s)

Ken Beath

Examples


# 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]])))


randomLCA documentation built on July 9, 2023, 6:09 p.m.