Skip to content
Back to formatted view

Raw Message

Message-ID: <1303225214611-3460651.post@n4.nabble.com>
Date: 2011-04-19T15:00:14Z
From: Chris Stubben
Subject: Markov transition matrices , missing transitions for certain years
In-Reply-To: <1303174027882-3459072.post@n4.nabble.com>

To keep the table dimensions the same, try changing the columns to factors...


boxes$y97<-factor(boxes$y97, 1:4)
boxes$y98<-factor(boxes$y98, 1:4)
boxes$y99<-factor(boxes$y99, 1:4)
...

> table(boxes$y98, boxes$y97)
   
    1 2 3 4
  1 1 0 1 0
  2 0 0 0 0
  3 0 0 0 0
  4 1 0 0 1
> table(boxes$y99, boxes$y98)
   
    1 2 3 4
  1 1 0 0 1
  2 0 0 0 0
  3 0 0 0 0
  4 1 0 0 1

Chris


Abby_UNR wrote:
> 
> My problem is that there are 16 possible transitions, but not all possible
> transitions occur at each time step. Therefore, don't think I could do
> something easy like create a table for each time step and add them
> together, for example:
> 
>> t1.boxes <- table(boxes$y98, boxes$y97)
>> t1.boxes
>    
>     1 3 4
>   1 1 1 0
>   4 1 0 1
>> t2.boxes <- table(boxes$y99, boxes$y98)
>> t2.boxes
>    
>     1 4
>   1 1 1
>   4 1 1
>> 
> 
> 


--
View this message in context: http://r.789695.n4.nabble.com/Markov-transition-matrices-missing-transitions-for-certain-years-tp3459072p3460651.html
Sent from the R help mailing list archive at Nabble.com.