# msm package: Mutlti state model initial value in 'vmmin' is not finite

I am new to msm package and markov models. I have a randomized trial dataset with readings from three time points: baseline, at 1 year, and at 2 year. I am trying to calculate annual transition probabilities and mean soujurn time for each state for the following two scenarios.

1. NGT to iIFG and regression to NGT or progression to diabetes (i.e., NGT <-> iIFG -> diabetes)
2. NGT to iIFG to diabetes (i.e., NGT -> iIFG -> diabetes)

States are glycemic states (NGT (state=1), iIFG (state=2), and diabetes (state=3)). Diabetes is the absorbing state.

Here is what my data looks like. Note that not all participants have reading from all 3 time points, but all of them have readings for atleast 2 time points (baseline and at 1 year). There are no NA values in the df. Time is in years. I set the time for baseline reading as 0.

showing some rows for example.

participant_num | time | state
2   0.0000000   2
2   2.0123203   3
3   0.0000000   1
3   1.0157427   1
3   2.0123203   1
4   0.0000000   2
4   1.0157427   2
4   2.0123203   3
5   1.0157427   2
5   2.0123203   2
7   0.0000000   1
7   1.0157427   1
7   2.0123203   2
8   0.0000000   2
8   1.0157427   2
8   2.0123203   2
9   0.0000000   2
9   1.0157427   1
9   2.0123203   1
10  0.0000000   2
10  1.0157427   1
10  2.0123203   1

m1 <- statetable.msm(state, participant_num, data=df)
m1

to
from   1   2   3
1 269 195   6
2 162 626  58
3   0   1  42

summary(df\$time)

Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
0.000   0.000   1.185   1.039   2.012   2.585


##scenario 1: NGT <-> iIFG -> diabetes

trans_mat <- matrix(c(1, 1,1,
1, 1, 1,
0, 0, 0),
nrow = 3, byrow = TRUE)
rownames(trans_mat) <- colnames(trans_mat) <- c("NGT", "iIFG", "Diabetes")

NGT iIFG Diabetes
NGT        1    1        1
iIFG       1    1        1
Diabetes   0    0        0

mm <- msm(state ~ time, subject=participant_num, data=df, deathexact=TRUE, gen.inits = TRUE, qmatrix=trans_mat)

Error in optim(method = "BFGS", control = list(), par = c(qbase = -0.943801885337371,  :
initial value in 'vmmin' is not finite


How should I solve this? Is my trans_mat wrong? or the format of my data is wrong? I would appreciate any help and suggestions. Thank you!

• It certainly would help the software to supply a valid and non-singular starting transition matrix!
– whuber
Commented May 3 at 16:45

         matrix(c(0, 1, 0,