1
$\begingroup$

I've been going through the manual of the R msm package for multi-state Markov models and have a question regarding how the default intensities are reported. The code below is taken from the documentation:

twoway4.q <- rbind(
  c(0, 0.25, 0, 0.25),
  c(0.166, 0, 0.166, 0.166),
  c(0, 0.25, 0, 0.25),
  c(0, 0, 0, 0)
)

cavsex.msm <- msm::msm( state ~ years, subject=PTNUM, data = msm::cav, qmatrix = twoway4.q, death = 4, 
  covariates = ~ sex)

Now, I've defined

intens1 <- msm::qmatrix.msm(cavsex.msm)
intens2 <- msm::qmatrix.msm(cavsex.msm, covariates = list(sex = mean(msm::cav$sex)))

The default value of the covariates parameter of the msm::qmatrix.msm function is 'mean'. Indeed, msm::qmatrix.msm(cavsex.msm, covariates = 'mean') gives the same response as intens1; 'mean' here is defined as 'denoting the means of the covariates in the data'.

The question: why are intens1 and intens2 different? The latter pre-calculates the mean of the sex covariate and passes it to the function, but I would think the responses should be the same.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.