Re: [R] nth step transition matrices

From: Rolf Turner <r.turner_at_auckland.ac.nz>
Date: Wed, 23 Apr 2008 12:14:57 +1200

(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}}

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. Received on Wed 23 Apr 2008 - 00:18:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 Apr 2008 - 00:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive