[R] Bootstrapping gnls models

Christoph Scherber Christoph.Scherber at agr.uni-goettingen.de
Fri Nov 7 14:14:29 CET 2008


Dear all,

I am trying to bootstrap predictions from gnls models using the following code:

# a is the dataframe with which I am working; it contains the variables
# response.variable,LD,L,G,P and F

###

model=gnls(response.variable ~ a * LD/(b + LD),
         params = list(a + b ~ L), start = c(1,1,1,1), data=a)

df=cbind(a,fit=predict(model,list(LD=1,L=0.5,G=0.5,P=0.46,F=2.2)))
model.bootfunc=function(rs,i){
	df$response.variable=df$fit+rs[i]
	as.numeric(predict(gnls(response.variable ~ a * LD/(b + LD),
         params = list(a + b ~ L), start = coef(model), data=df)))
}

rs=scale(resid(model),scale=F)
(model.boot=boot(rs,model.bootfunc,R=1))
booted=boot.ci(model.boot,index=1,type=c("norm","basic","perc","bca"))

###

The problem is that this code yields "NA" for the s.e. of the bootstrap statistics:

Bootstrap Statistics :
       original       bias    std. error
t1*  0.1651658 -0.020663364          NA
t2*  0.1669592 -0.021759335          NA
t3*  0.1676765 -0.001858686          NA
t4*  0.1726982 -0.025321349          NA
t5*  0.1658092  0.024721214          NA


And hence the boot.ci function and others don?t work.

Does anyone have an idea on that?

Many thanks and best wishes
Christoph



-- 
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW, Agroecology
Waldweg 26
D-37073 Goettingen
Germany

phone +49 (0)551 39 8807
fax   +49 (0)551 39 8806

Homepage http://www.gwdg.de/~cscherb1



More information about the R-help mailing list