nhm {nhm} | R Documentation |
Fit a non-homogeneous Markov model using maximum likelihood
Description
Fit a continuous-time Markov or hidden Markov multi-state model by maximum likelihood. Observations of the process can be made at arbitrary times, or the exact times of transition between states can be known. Covariates can be fitted to the Markov chain transition intensities or to the hidden Markov observation process.
Usage
nhm(model_object, initial=NULL, gen_inits=FALSE,
control, score_test=FALSE, fixedpar=NULL)
Arguments
model_object |
Model object created using |
initial |
Vector of initial parameter values |
gen_inits |
If |
control |
Object of class |
score_test |
If |
fixedpar |
Numerical vector indicating which parameters are taken as fixed at the value specified by |
Details
For more details about the methodology behind the nhm package, see Titman (2011) and the package vignette.
Value
By default returns an object of class nhm
containing model output data such as the estimated parameters, maximized likelihood value, information matrix etc. The object can be used with print
, predict
, plot
and anova
.
If score.test=TRUE
then returns an object of class nhm_score
. See print.nhm_score
for more details.
Author(s)
Andrew Titman a.titman@lancaster.ac.uk
References
Titman AC. Flexible Nonhomogeneous Markov Models for Panel Observed Data. Biometrics, 2011. 67, 780-787.
See Also
model.nhm
, nhm.control
, plot.nhm
, predict.nhm
, print.nhm_score
Examples
### Example dataset
### For further examples, see the vignette
trans <- rbind(c(0,1,0,0),c(0,0,2,0),c(0,0,0,3),rep(0,4))
nonh <- rbind(c(0,1,0,0),c(0,0,2,0),c(0,0,0,3),rep(0,4))
gomp_model <- model.nhm(state~time, data=example_data1, subject = id,
type="gompertz",trans=trans,nonh=nonh)
initial_val <- c(-0.65,-0.45,-0.55,0,0,0)
gomp_fit <- nhm(gomp_model,initial=initial_val,control=nhm.control(obsinfo=FALSE))
gomp_fit
plot(gomp_fit)
plot(gomp_fit,what="intensities")