Skip to content

Numerical overflow when restricting a single transition path in msm #131

@superjlix

Description

@superjlix

Dear Professor Chris Jackson: I would like to ask you a question.I am writing to report a numerical overflow error encountered when fitting a 4-state continuous-time Markov model using the msm package in R. I am analyzing longitudinal cohort data with four states, and my statetable.msm() output confirms valid transitions between all allowed paths (counts: 1→1=25029, 1→2=1182, 1→3=23231, 1→4=2130; 2→1=486, 2→2=1237, 2→3=718, 2→4=2250; 3→1=10461, 3→2=643, 3→3=43579, 3→4=4220; 4→1=492, 4→2=1185, 4→3=2629, 4→4=8181). I specified a custom initial Q matrix (Q_try1) with c(0,0.1,0,0), c(0.1,0,0,0.1), c(0.1,0,0,0.1), c(0,0.1,0.1,0) for the four rows, and fitted the model with msm(state ~ time, subject = id, data = msm_data_try, qmatrix = Q_try1, method="BFGS", obstype = 1, control = list(maxit=10000000, fnscale=50000)), but received the error: Error in Ccall.msm(params, do.what = "lik", ...) : numerical overflow in calculating likelihood. My data is a dataset with valid observed transitions for all other states, and I have checked that there are no missing values for the state, time, or ID variables. The model only fails when I disable exactly one transition path, and I am writing to ask why restricting a single transition path would cause this numerical overflow issue and how I can fix this to properly fit the model with forbidden transitions. Thank you very much 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