plot.LMest: Plots for Generalized Latent Markov Models

plotR Documentation

Plots for Generalized Latent Markov Models

Description

Plots for outputs of LMest objects: LMbasic, LMbasiccont, LMlatent, LMlatentcont, and LMsearch

Usage


## S3 method for class 'LMbasic'
plot(x,
                            what = c("modSel", "CondProb", "transitions","marginal"),
                            verbose=interactive(),...)
## S3 method for class 'LMlatent'
plot(x,
                            what = c("modSel", "CondProb", "transitions","marginal"),
                            verbose=interactive(),...)
## S3 method for class 'LMbasiccont'
plot(x,
                                what = c("modSel", "density", "transitions","marginal"),
                                components,verbose=interactive(),...)
## S3 method for class 'LMlatentcont'
plot(x,
                                 what = c("modSel", "density", "transitions","marginal"),
                                 components, verbose=interactive(),...)
## S3 method for class 'LMsearch'
plot(x,...)

Arguments

x

an object of class LMbasic, LMlatent, LMbasiccont, LMlatentcont or LMsearch

what

a string indicating the type of plot. A detailed description is provided in the ‘Details’ section.

components

An integer or a vector of integers specifying the components (latent states) to be selected for the "density" plot.

verbose

A logical controlling if a text progress bar is displayed during the fitting procedure. By default is TRUE if the session is interactive, and FALSE otherwise.

...

Unused argument.

Details

The type of plots are the following:

"modSel" plot of values of the Bayesian Information Criterion and of the Akaike Information
Criterion for model selection
"CondProb" plot of the estimated conditional response probabilities
"density" plot of the overall estimated density for continuous responses, with weights given by
the estimated marginal distribution of the latent variable. For multivariate continuous
responses a contour plot is provided. If the argument components is specified, the
density plot for the selected components results
"transitions" path diagram of the estimated transition probabilities
"marginal" plot of the estimated marginal distribution of the latent variable

If argument what is not specified, a menu of choices is proposed in an interactive session.

Author(s)

Francesco Bartolucci, Silvia Pandolfi, Fulvia Pennoni, Alessio Farcomeni, Alessio Serafini

Examples

## Not run: 
### Plot of basic LM model

data("data_SRHS_long")
SRHS <- data_SRHS_long[1:2400,]

# Categories rescaled to vary from 0 (“poor”) to 4 (“excellent”)

SRHS$srhs <- 5 - SRHS$srhs

out <- lmest(responsesFormula = srhs ~ NULL,
            index = c("id","t"),
            data = SRHS,
            k = 1:3,
            start = 1,
            modBasic = 1,
            seed = 123)
out
summary(out)
plot(out)

### Plot of basic LM model for continuous responses

data(data_long_cont)

out1 <- lmestCont(responsesFormula = Y1 + Y2 + Y3 ~ NULL,
                  index = c("id", "time"),
                  data = data_long_cont,
                  k = 1:5,
                  modBasic=1,
                  tol=10^-5)

plot(out1,what="modSel")

plot(out1,what="density")
plot(out1,what="density",components=c(1,3))


## End(Not run)

LMest documentation built on Aug. 27, 2023, 5:06 p.m.