[R] power of a matrix

From: Rau, Roland <Rau_at_demogr.mpg.de>
Date: Wed 17 Aug 2005 - 20:15:46 EST

Dear all,

I have a population with three age-classes, at time t=0 the population is:
n.zero <- c(1,0,0)
I have a transition matrix A which denotes "fertility" and "survival":

A <- matrix(c(0,1,5, 0.3,0,0, 0,0.5,0), ncol=3, byrow=TRUE)

To obtain the population at t=1, I calculate: A %*% n.zero

To obtain the population t=2, I calculate: A %*% (A %*% n.zero)

... and so on ...

I thought now to obtain the population at time x, I should simply do: A^x %*% n.zero

But this, of course, does not work since the following two statements are not equivalent for matrices:
A %*% A
A * A

Is there something like a "powermatrix"-function?


P.S. The example is taken from:
Example 3.1 ("A linear, time-invariant model") from Keyfitz/Caswell: "Applied Mathematical Demography", 3rd Edition, 2005, p. 52f

This mail has been sent through the MPI for Demographic Rese...{{dropped}}

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Aug 17 20:22:14 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:50 EST