[R] nth step transition matrices
Rolf Turner
r.turner at auckland.ac.nz
Wed Apr 23 02:14:57 CEST 2008
(a) Is this a homework question?
(b) Your value of P^2 is very rough --- only 2 decimal places.
(c) The answer to the question ``Is there a way ...?'' is ``Of course!''
There is always a way in R.
(d) In this case I would write a function, say ``matpow(M,n)'' to
calculate
the n-th power of M.
(e) I would use a for loop to do this.
(f) From here on, you're on your own.
cheers,
Rolf Turner
On 23/04/2008, at 11:49 AM, Brad Lukoskie wrote:
> Hello,
>
> I have a question in regards to markov chains and transition
> probabilities.
>
> I am trying to figure out a way to calculate the "kth-step transition
> matrix" of a given matrix.
>
> Say for example I have a single step 2x2 matrix:
>
>
> 1 2
> P= 1 .95 .05
> 2 .01. 99
>
> If I were to convert this matrix to a 2-step transition probability
> matrix I would get:
>
> 1 2
> P^2 = 1 .90 .10
> 2 .02 .98
>
> Is there a way to use [R] to calculate the nth step of a given matrix?
>
> Thanks,
>
> -Brad
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
More information about the R-help
mailing list