0

I am having some trouble fitting a transtion matrix. While analysing panel data I need to fit a transition matrix (with standard error) to the crosstable shown below or the underlying data. It shows participants transitioning between income states in the first two waves.

By converting it to a markovchain object using the markovchain package, I only get the transtion percentages, but no standard errors. How do I get those?

          1    2    3    4    5    6
      1  2639 156  69   49   21   42
      2  150  300  53   11   1    1
      3  74   20   363  48   8    4
      4  60   7    46   384  65   12
      5  42   2    5    75   275  63
      6  40   0    1    15   52   402

library(markovchain)
mcobject<-as(mytableX, "markovchain")


         1           2           3          4           5           6
1 0.88676075 0.052419355 0.023185484 0.01646505 0.007056452 0.014112903
2 0.29069767 0.581395349 0.102713178 0.02131783 0.001937984 0.001937984
3 0.14313346 0.038684720 0.702127660 0.09284333 0.015473888 0.007736944
4 0.10452962 0.012195122 0.080139373 0.66898955 0.113240418 0.020905923
5 0.09090909 0.004329004 0.010822511 0.16233766 0.595238095 0.136363636
6 0.07843137 0.000000000 0.001960784 0.02941176 0.101960784 0.788235294

1 Answers1

0

You can use the multinomialConfidenceIntervals function.

library(markovchain)
#get your data
ciau.matrix<-matrix(c(2639, 156  ,69,   49  , 21,   42,
150,  300  ,53 ,  11  , 1  ,  1,
74,   20  , 363 , 48   ,8   , 4,
60,   7  ,  46   ,384 , 65   ,12,
42,   2 ,   5    ,75 ,  275 , 63,
40,   0,    1    ,15,   52  , 402),nrow = 6,byrow = TRUE)

ciau.table<-as.table(ciau.matrix)

ciau.Markovchain<-as(ciau.table,"markovchain")
#use the multinomialConfidenceInterval to obtain confidence intervals
multinomialConfidenceIntervals(transitionMatrix=ciau.Markovchain@transitionMatrix, 
                               countsTransitionMatrix=ciau.matrix, confidencelevel=.95)
Giorgio Spedicato
  • 2,413
  • 3
  • 31
  • 45