Learn R Programming

randomLCA (version 1.1-4)

plot: Plot a randomLCA object

Description

Plots the outcome probabilities for a randomLCA object, for random effects objects this can be either marginal or conditional or both. For a 2 level random effects model conditional2 will condition on the subject random effect and integrate over the period random effects. Note that plot is based on the xyplot function.

Usage

# S3 method for randomLCA
plot(x, ... , graphtype = ifelse(x$random, "marginal", "conditional"), 
     conditionalp = 0.5, classhorizontal = TRUE)

Arguments

x

randomLCA object

graphtype

Type of graph

conditionalp

For a conditional graph the percentile corresponding to the random effect at which the outcome probability is to be calculated

classhorizontal

classes to be plotted across the page

...

additional parameters to xyplot

Author

Ken Beath ken.beath@mq.edu.au

See Also

calcCondProb, calcMargProb

Examples

Run this code
# \donttest{
# standard latent class with 2 classes
uterinecarcinoma.lca2 <- randomLCA(uterinecarcinoma[, 1:7], freq = uterinecarcinoma$freq, cores = 1)
plot(uterinecarcinoma.lca2)
uterinecarcinoma.lcarandom2 <- randomLCA(uterinecarcinoma[, 1:7], 
  freq = uterinecarcinoma$freq, random = TRUE, probit = TRUE, quadpoints = 61, cores = 1)
# default for random effects models is marginal
plot(uterinecarcinoma.lcarandom2)
# default for random effects models conditional is p = 0.5 i.e. median
plot(uterinecarcinoma.lcarandom2, graphtype = "conditional")
# look at variability by plotting conditional probabilities at 0.05, 0.5 and 0.95
plot(uterinecarcinoma.lcarandom2, graphtype = "conditional", conditionalp = c(0.05, 0.5, 0.95))
# }

Run the code above in your browser using DataLab