[R] replacement bootstrapping

Mhairi malexander06 at qub.ac.uk
Thu Feb 3 18:49:06 CET 2011


Hi there


I am looking at the functional response (the consumption of single predators
of prey over a range of prey densities) and Im having issues with the
following script when trying to obtain mutliple replicates of coefficients
(a and h) from the following nls model based on Hollings disc equation:


> model<-nls(eaten~(a*suppl)/(1+a*h*suppl),start=list(a=1.2,h=0.015),data=rep)


#which produces the following 


Formula: eaten ~ (a * suppl)/(1 + a * h * suppl)

Parameters:
  Estimate Std. Error t value Pr(>|t|)    
a  2.97344    1.72972   1.719 0.093340 .  
h  0.09447    0.02247   4.205 0.000143 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 4.545 on 40 degrees of freedom

Number of iterations to convergence: 8 
Achieved convergence tolerance: 3.002e-06 



# I am then trying to bootstrap the model to obtain multiple parameter
estimates which I can then compare between the two data sets I have using a
t test (hopefully)


> library(bootstrap)   
> repnew<-cbind(as.numeric(rep[,2]),as.numeric(rep[,3]))  #had to convert
> data to matrix as it wasnt numeric 
> theta<-function(repnew){coef(eval(repmod$call))}
> bootstrap(repnew,10,theta)
> bootstrap(repnew,100,theta)


#When I repeated bootstrapping 10 and then 100 times I keep getting the same
values for the coefficients a and h. This code was adapted from another
users code who had the same problem and as of yet I cant figure out waht is
wrong. Do I need state that I want to use replacement sampling or is this
already assumed?

Thank you for any help :)
-- 
View this message in context: http://r.789695.n4.nabble.com/replacement-bootstrapping-tp3258599p3258599.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list