[R] bootstrap function coefficients

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Apr 9 12:16:14 CEST 2004


Package bootstrap is ORPHANED (that is, unsupported by anyone).  Do try 
package boot instead.

10 is a very small number of bootstrap replications: I do suggest you try 
100 or more.

On Fri, 9 Apr 2004, Michaël  Coeurdassier wrote:

> Dear R community,
> 
> Please, can you help me with a problem concerning bootstrap. The data table 
> called «RMika», contained times (Tps) and corresponding concentration of a 
> chemical in a soil (SolA). I would like to get, by bootstraping, 10 
> estimations of the parameters C0 and k from the function: SolA = 
> C0*exp(-k*Tps).
> 
> # First, I fit the data and all is OK
> 
>  > tabMika<-read.delim("RMika.txt")
>  > library(nls)
>  > attach(tabMika)
>  > Expon<-function(Tps,parm){
> + C0<-parm[1]
> + k<-parm[2]
> + }
>  > DegSA.nls<-nls(SolA~C0*exp(-k*Tps),start=c(C0=35, k=1),tabMika)
>  > summary(DegSA.nls)
> 
> Formula: SolA ~ C0 * exp(-k * Tps)
> 
> Parameters:
>      Estimate Std. Error t value Pr(>|t|)
> C0 25.682104   1.092113   23.52  < 2e-16 ***
> k   0.087356   0.007582   11.52 6.36e-13 ***
> ---
> Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
> 
> Residual standard error: 2.584 on 32 degrees of freedom
> 
> Correlation of Parameter Estimates:
>        C0
> k 0.7101
> 
> 
> # Second, I try to use bootstrap to get the 10 estimates of k and C0
> 
> 
>  > library(bootstrap)
>  > theta<-function(tabMika){coef(eval(DegSA.nls$call))}
>  > bootSolA.nls<-bootstrap(tabMika,10,theta)
> 
> Warning message:
> multi-argument returns are deprecated in: return(thetastar, func.thetastar, 
> jack.boot.val, jack.boot.se,
> 
>  > bootSolA.nls
> $thetastar
>            [,1]        [,2]        [,3]        [,4]        [,5]        [,6]
> C0 25.68210358 25.68210358 25.68210358 25.68210358 25.68210358 25.68210358
> k   0.08735615  0.08735615  0.08735615  0.08735615  0.08735615  0.08735615
>            [,7]        [,8]        [,9]       [,10]
> C0 25.68210358 25.68210358 25.68210358 25.68210358
> k   0.08735615  0.08735615  0.08735615  0.08735615
> 
> # As you can notify, the 10 estimations have the same values for C0 and k. 
> Moreover, this correspond to the values of k and C0 determined by fitting 
> all the data without bootstrap!!!???
> I cannot find what is wrong. Please, if you find a solution, thank you to 
> send it to me.
> 
> Sincerely
> 
> Michael Coeurdassier


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list