Description Usage Arguments Details Author(s) References Examples
Graph with transition-specific hazard functions derived from an age-dependent model fitted using 'msm'
1 2 3 4 |
x |
Fitted |
b.covariates |
List with specified covariates values for the prediction (ignore intercept) |
no.years |
Number of years for the prediction |
trans |
Matrix with rows (r,s) for hazard of going from state r to state s. Default to all (r,s)-hazards that are modelled in |
max.haz |
Upperbound hazard-axis |
min.haz |
Lowerbound hazard-axis |
CI |
TRUE for plotting 95% confidence bands. FALSE otherwise |
col |
Colour for each hazard curve. Example for two curves: |
lty |
Line type for each hazard curve. Example for two curves: |
lwd |
Width of line for each hazard curve. Example for two curves: |
LEGEND |
TRUE for adding a legend. FALSE otherwise |
location |
Location for legend. Default to |
age.shift |
Value to shift the age scale in the graph. Useful when age in the model is on a shifted scale. Default to 0. |
This function is an add-on to the functionality in the 'msm' package. A Gompertz model with age as the time scale can be fitted in 'msm' piecewise-constantly by adding age as a covariate. The function qmatrix.msm
is used by hazards
repeatedly to take into account the age dependence when calculating the hazards.
Ardo van den Hout. With thanks to Ying Lou.
Jackson, C.H. (2011). Multi-State Models for Panel Data: The msm Package for R., Journal of Statistical Software, 38(8), 1-29.
1 2 3 4 5 6 7 8 | # Fit msm model:
Q <- rbind(c(0,0.01,0.01), c(0,0,0.01), c(0,0,0))
model <- msm(state~age, subject = id, data = electData,
center = FALSE, qmatrix = Q, deathexact = TRUE,
covariates = ~age+x)
# Plot hazards on original age scale:
hazards(model, b.covariates = list(age = 0, x = 0),
no.years = 20, max.haz = 0.25, age.shift = -70)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.