plot.nhm: Plot transition probabilities, intensities or state...

View source: R/utils.R

plot.nhmR Documentation

Plot transition probabilities, intensities or state occupation probabilities from a fitted nhm model.

Description

Produces plots of the transition probabilites, intensities or state occupation probabilities from a non-homogeneous Markov or misclassification type hidden Markov multi-state model fitted using nhm.

Usage

## S3 method for class 'nhm'
plot(x, what="probabilities",time0=0, state0=1, times=NULL,
covvalue=NULL, ci=TRUE, sim=FALSE, coverage=0.95, B=1000, rtol=1e-6,
atol=1e-6, initp=NULL, ltrunc=NULL, main_arg=NULL, xlab="Time", 
statemerge=FALSE, ...)

Arguments

x

Fitted model object produced using nhm.

what

Character string to indicate what should be plotted. Options are probabilities (the default which produces transition probabilities),intensities (to produce a plot of the intensities) or stateoccup (to produce a plot of the state occupation probabilities).

time0

The starting time from which to compute the transition probabilities or intensities.

state0

Starting state from which to compute the transition probabilities. Defaults to 1. Not required for transition intensities or state occupation probabilities.

times

Optional vector of times at which to compute the transition probabilities or intensities. If omitted, the probabilities/intensities will be computed at a sequence of times of length 100 from time0 to the maximum observed time in the data.

covvalue

Optional vector of covariate vectors (should be given in the order specified in the covariate option in nhm). If omitted the function will use the mean values of the covariates.

ci

If TRUE pointwise confidence intervals will be shown in addition to the point estimates.

sim

If TRUE a simulation Delta method (Mandel, 2013) will be used to calculate the confidence intervals. Otherwise the standard Delta method will be applied.

coverage

Coverage level (should be a value between 0 and 1) for the confidence intervals. Defaults to 0.95.

B

Number of simulations to be performed to compute the simulation Delta method.

rtol

Relative tolerance parameter to be used by lsoda when solving the differential equations for the transition probabilites.

atol

Absolute tolerance parameter to be used by lsoda when solving the differential equations for the transition probabilites.

initp

Optional vector of initial state occupation probabilities. If omitted then will use the estimates from the model fit.

ltrunc

Optional list containing "ltruncation_states": a vector specifying the indices of the non-absorbing states. "ltruncation_time": the time/age at which patients are left-truncation. Note: this list can be omitted if original model involved left-truncation.

main_arg

Character string specifying beginning of title to be given to each of the plot panes generated.

xlab

Character string specifying x-axis label to be given to each plot.

statemerge

Logical of whether the estimates should merge together latent states. Only relevant for models fitted using phasemap option. By default (FALSE) the probabilities for the latent states will be given.

...

Other items to be passed to the function. Currently not used.

Details

Computation is performed by calling predict.nhm, for the transition probabilities, qmatrix.nhm for the intensities or state_occupation_probability.nhm for state occupation probabilities (see for more details).

Value

Generates a multi-pane plot for each state. If values are required they can be obtained using predict.nhm.

Author(s)

Andrew Titman a.titman@lancaster.ac.uk

References

Mandel M. Simulation-based confidence intervals for functions with complicated derivatives. 2013. The American Statistician, 67. 76-81.

See Also

nhm, predict.nhm, qmatrix.nhm


nhm documentation built on Sept. 1, 2025, 1:08 a.m.

Related to plot.nhm in nhm...