Skip to content

pmatrix.msm error ("Infinite matrix entry") and sojourn.msm gives identical results for both sexes #124

@tomato-git-hub

Description

@tomato-git-hub

Hi Prof. Jackson,
I hope all is well.
I am using msm to fit a four-state disease model (states 1,2,3 are transient, state 4 absorbing). The covariate sex is essential to compare male vs. female transition patterns in a specific region.

The model runs fine on the full dataset, but after subsetting to the region of interest (sample size decreases), I encounter:

  1. pmatrix.msm fails with: Error in balance(baP$z, "s") : R_dgebal(*, type="S"): Infinite matrix entry.
  2. sojourn.msm returns identical estimates for covariates = list(sex="male") and sex="female", indicating the covariate effect is not captured.

sojourn.msm(data.msm_region, covariates=list(sex="male"))
Warning message:
In msm.parse.covariates(x, covariates, x$qmodel) :
Ignoring covariates - no covariates in this part of the model

Diagnostic evidence:

  1. Fitted Q-matrix for the regional data (extremely wide CIs for some transitions):
    State 1 -> State 3: 9.745e-07 (6.921e-17, 1.372e+164)
    State 3 -> State 1: 1.164e-09 (0.000e+00, Inf)
    These suggest highly unstable parameter estimates.
  2. Sex-specific transition frequencies (regional subset):
    Males: 1→3 (162), 3→1 (125)
    Females: 1→3 (369), 3→1 (216)
    Although non-zero, the per-sex sample size for these transitions may be insufficient to stably estimate covariate effects.

Attempted fix:
I switched to L-BFGS-B with maxit = 100000,but the problem persists.

control = list(method = "L-BFGS-B", control = list(maxit = 100000, trace = 1))

My questions:

  1. What are the likely reasons for this behavior? Is it due to sparse data per sex for certain transitions, leading to flat likelihoods or boundary estimates for covariate parameters?
  2. What should be the next steps?

Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions