pearson.msm(x, transitions=NULL, timegroups=3, intervalgroups=3,
covgroups=3, groups=NULL, boot=FALSE, B=500,
next.obstime=NULL, N=100, indep.cens=TRUE,
maxtimes=NULL, pval=TRUE)
msm
. All objects used in the original call to msm
which
produced x
, such as the qmatrix
, should be in the
working environm
x$data$n
(the
number of observations used in the model fit) giving the time to the
next scheduled observation following each time point.
This is only used when times to death are known exactly.
TRUE
, then times to censoring are included
in the estimation of the distribution to the next scheduled
observation time. If FALSE
, times to censoring are assumed to
be systematically different from other observatix$data$n
, or a common
scalar, giving an upper bound for the next scheduled observation
time. Used in the multiple imputation when times to death are known exactly.
If a value greater than maxtimes
"test"
stat
. The test statistic is the sum of the deviances.
For panel-observed data without exact death times,
misclassification or censored observations, p
is the
p-value for the test statistic calculated using the improved
approximation of Titman (2009). For these models, for comparison with older versions of the package,
test
also presents p.lower
and p.upper
, which are
theoretical lower and upper limits for the p-value of the test
statistic, based on df.lower
and
df.upper
degrees of freedom, respectively. df.upper
is
the number of independent cells in the contingency table, and
df.lower
is df.upper
minus the number of estimated
parameters in the model.
"intervalq"
"sim"
With exact death times, the null variance of the test statistic (formed
by taking mean of simulated test statistics) is less than twice the
mean (Titman, 2008), and the null distribution is not p.upper
is an upper limit for the true asymptotic
p-value, but p.lower
is not a lower limit, and is not presented.
"boot"
"lambda"
prevalence.msm
can be used to assess fit, though without a formal test.When times of death are known exactly, states are misclassified, or an individual's final observation is a censored state, the modification by Titman and Sharples (2008) is used. The only form of censoring supported is a state at the end of an individual's series which represents an unknown transient state (i.e. the individual is only known to be alive at this time). Other types of censoring are omitted from the data before performing the test.
See the references for further details of the methods.
The method used for censored states is a modification of the method
in the appendix to Titman and Sharples (2008), described at
Groupings of the time since initiation, the time interval and the impact of covariates are based on equally-spaced quantiles. The number of groups should be chosen that there are not many cells with small expected numbers of transitions, since the deviance statistic will be unstable for sparse contingency tables. Ideally, the expected numbers of transitions in each cell of the table should be no less than about 5. Conversely, the power of the test is reduced if there are too few groups. Therefore, some sensitivity analysis of the test results to the grouping is advisable.
Saved model objects fitted with previous versions of R (versions less
than 1.2) will need to be refitted under the current R for use with
pearson.msm
.
Titman, A. and Sharples, L. (2008) A general goodness-of-fit test for Markov and hidden Markov models. Statistics in Medicine 27(12):2177-2195
Titman, A. (2009) Computation of the asymptotic null distribution of goodness-of-fit tests for multi-state models. Lifetime Data Analysis 15(4):519-533.
Titman, A. (2008) Model diagnostics in multi-state models of biological systems. PhD thesis, University of Cambridge.
msm
, prevalence.msm
, scoreresid.msm
,psor.q <- rbind(c(0,0.1,0,0),c(0,0,0.1,0),c(0,0,0,0.1),c(0,0,0,0))
psor.msm <- msm(state ~ months, subject=ptnum, data=psor,
qmatrix = psor.q, covariates = ~ollwsdrt+hieffusn,
constraint = list(hieffusn=c(1,1,1),ollwsdrt=c(1,1,2)))
pearson.msm(psor.msm, timegroups=2, intervalgroups=2, covgroups=2)
# More 1-2, 1-3 and 1-4 observations than expected in shorter time
# intervals - the model fits poorly.
# A random effects model might accommodate such fast progressors.
Run the code above in your browser using DataLab