[R] msm and pmatrix
Peter Adamson
peter.adamson at egu.york.ac.uk
Mon Sep 28 16:44:49 CEST 2009
Dear All,
I’m using R package ‘msm’ to fit a multi state model to infection history
data (counts of infections per month upto diagnosis of a particular disease
(sink state is state 11). The observed transitions are as follows:
to
from 1 2 3 4 5 6 7 8 10 11
1 35192 3806 899 233 46 11 3 0 1 534
2 3801 790 249 69 15 6 2 1 0 134
3 932 228 82 25 13 3 0 0 0 46
4 236 59 33 7 4 6 0 0 0 14
5 51 21 5 3 2 0 0 0 0 7
6 15 7 3 1 2 0 0 0 0 1
7 5 1 1 1 0 0 0 0 0 0
8 1 0 0 0 0 0 0 0 0 0
10 0 1 0 0 0 0 0 0 0 0
A simple multi-state model returns the following intensity matrix:
Maximum likelihood estimates:
Transition intensity matrix
1 2 3
4 5
1 -0.1359 (-0.1395,-0.1323) 0.09346 (0.09053,0.09647) 0.02207
(0.02068,0.02357) 0.005721 (0.005032,0.006505) 0.00113 (0.000846,0.001508)
2 0.7501 (0.7267,0.7744) -0.8441 (-0.8698,-0.8192) 0.04914
(0.0434,0.05564) 0.01362 (0.01076,0.01724) 0.00296 (0.001785,0.00491)
3 0.7013 (0.6577,0.7478) 0.1716 (0.1507,0.1953) -0.9383
(-0.9919,-0.8876) 0.01881 (0.01271,0.02784) 0.009782 (0.00568,0.01685)
4 0.6574 (0.5786,0.7468) 0.1643 (0.1273,0.2121) 0.09192
(0.06535,0.1293) -0.9805 (-1.088,-0.8832) 0.01114 (0.004182,0.02969)
5 0.573 (0.4355,0.754) 0.236 (0.1538,0.3619) 0.05618
(0.02338,0.135) 0.03371 (0.01087,0.1045) -0.9775 (-1.206,-0.7923)
6 0.5172 (0.3118,0.858) 0.2414 (0.1151,0.5063) 0.1034
(0.03336,0.3207) 0.03448 (0.004857,0.2448) 0.06897 (0.01725,0.2758)
7 0.625 (0.2601,1.502) 0.125 (0.01761,0.8874) 0.125
(0.01761,0.8874) 0.125 (0.01761,0.8874) 0
8 1 (0.1409,7.099) 0 0
0 0
9 0 0 0
0 0
10 0 1 (0.1409,7.099) 0
0 0
11 0 0 0
0 0
6 7 8
9 10
1 0.0002701 (0.0001496,0.0004877) 7.366e-05 (2.376e-05,0.0002284) 0
0 2.455e-05 (3.459e-06,0.0001743)
2 0.001184 (0.000532,0.002636) 0.0003947 (9.872e-05,0.001578) 0.0001974
(2.78e-05,0.001401) 0 0
3 0.002257 (0.000728,0.006999) 0 0
0 0
4 0.01671 (0.007509,0.0372) 0 0
0 0
5 0 0 0
0 0
6 -1 (-1.439,-0.6949) 0 0
0 0
7 0 -1 (-2,-0.5001) 0
0 0
8 0 0 -1
(-7.099,-0.1409) 0 0
9 0 0 0
0 0
10 0 0 0
0 -1 (-7.099,-0.1409)
11 0 0 0
0 0
11
1 0.01311 (0.01205,0.01427)
2 0.02645 (0.02233,0.03132)
3 0.03461 (0.02593,0.04621)
4 0.039 (0.0231,0.06585)
5 0.07865 (0.0375,0.165)
6 0.03448 (0.004857,0.2448)
7 0
8 0
9 0
10 0
11 0
-2 * log-likelihood: 64615.3
Which seems plausible, however, extracting the transition probabilities
using pmatriix (at t=1) gives:
1 2 3 4 5 6
7 8 9 10 11
1 0.9054478 0.06084246 0.014901608 0.003903849 0.0008367198 0.0002307900
5.369672e-05 4.980968e-06 0 1.457826e-05 0.013763524
2 0.4898012 0.45268021 0.025441967 0.006992325 0.0016078599 0.0006118591
1.747896e-04 7.991718e-05 0 4.985068e-06 0.022604880
3 0.4685205 0.09100784 0.398191689 0.008992288 0.0041922757 0.0010294227
3.004231e-05 7.912784e-06 0 4.738914e-06 0.028023291
4 0.4494462 0.08906915 0.041839161 0.377271676 0.0049279805 0.0063594591
2.894941e-05 7.698071e-06 0 4.517754e-06 0.031045171
5 0.4088771 0.11474581 0.028549682 0.014579984 0.3767917106 0.0002500166
3.271528e-05 1.025989e-05 0 4.065169e-06 0.056158646
6 0.3938167 0.11987666 0.046914352 0.015309409 0.0262985772 0.3681546246
3.286685e-05 1.065551e-05 0 3.851946e-06 0.029582335
7 0.4435616 0.07627917 0.055356803 0.048419818 0.0008348049 0.0005421964
3.679054e-01 6.373819e-06 0 4.415240e-06 0.007089359
8 0.5936997 0.02523856 0.006121399 0.001599064 0.0003354685 0.0000894876
2.163217e-05 3.678809e-01 0 6.206303e-06 0.005007576
9 0.0000000 0.00000000 0.000000000 0.000000000 0.0000000000 0.0000000000
0.000000e+00 0.000000e+00 1 0.000000e+00 0.000000000
10 0.2030169 0.40494037 0.011295022 0.003112745 0.0007045151 0.0002724443
8.168259e-05 3.858055e-05 0 3.678809e-01 0.008656808
11 0.0000000 0.00000000 0.000000000 0.000000000 0.0000000000 0.0000000000
0.000000e+00 0.000000e+00 0 0.000000e+00 1.000000000
I was expecting a zero where the intensity matrix is equal to zero. For
example, the probabilities of moving from 7,8 and 10 to state 11 should be
zero. Am I missing something? I hope someone can shed some light on why I am
getting 'odd' results?
Thanks, Peter
--
View this message in context: http://www.nabble.com/msm-and-pmatrix-tp25645397p25645397.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list