[R] bootstrapping lambda values from projections matrices

From: Saskia Sandring <saskia.sandring_at_ebc.uu.se>
Date: Fri 10 Feb 2006 - 00:45:41 EST


Dear all,

I'm working with a population projections matrix model from demographic data. The dominant eigenvalue of the matrix is the growth rate of the population (lambda). I would like to estimate confidence intervals for the lambda values with bootstrap.
The function for calculating the eigenvalue I wrote like this:

mat.fun <- function(d,i){

    mat<-matrix(c(0,

    sum(d$klyear1[i]==1&d$classyear2[i]==2)/sum(d$classyear1[i]==1),
    sum(d$classyear1[i]==1&d$classyear2[i]==3)/sum(d$classyear1[i]==1), 0,
    sum(d$classyear1[i]==2&d$classyear2[i]==2)/sum(d$classyear1[i]==2),
    sum(d$classyear1[i]==2&d$classyear2[i]==3)/sum(d$classyear1[i]==2),
    sum(d$classyear1[i]==0&d$classyear2[i]==1)/sum(d$classyear1[i]==3),
    sum(d$classyear1[i]==3&d$classyear2[i]==2)/sum(d$classyear1[i]==3),
    sum(d$classyear1[i]==3&d$classyear2[i]==2)/sum(d$classyear1[i]==3),

sum(d$classyear1[i]==3&d$classyear2[i]==3)/sum(d$classyear1[i]==3)),ncol=3)

    abs(eigen(mat,only.values=T)$values[1]) }

Now, in the pooled matrix from all years I would like to sample in a way that the number of bootstrap samples taken from each year is equal to the number of data points from each year. Therefore I'm defining strata=year.

boot1 <- boot(myfile, mat.fun, 5000, strata=myfile$year); boot1

Is this the correct way to do it or did I misunderstand the strata-argument? I checked in Davison, A.C. and Hinkley, D.V. (1997), but I'm still not quite sure.

Thanks very much in advance for your help!

Sincerely,
Saskia Sandring



Saskia Sandring

Avd. för växtekologi, Evolutionsbiologiskt centrum, Uppsala universitet Dept. of Plant Ecology, Evolutionary Biology Centre, Uppsala University

Villavägen 14			tel: 018-471 2870 (int +46 18 4712870)
SE-752 36 Uppsala		fax: 018-55 34 19 (int +46 18 553419)
SWEDEN				email: saskia.sandring@ebc.uu.se

http://www.vaxtbio.uu.se/resfold/sandring.htm



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 Fri Feb 10 00:49:35 2006

This archive was generated by hypermail 2.1.8 : Sat 11 Feb 2006 - 02:02:57 EST