Francisco Mora Ardila
2012-Aug-14 18:58 UTC
[R] bootstrapped CI for nonlinear models using nlsBoot from nlstools
Hi all I?m trying to get confidence intervals for parameters from nls modeling. I fitted a nls model to the following variables:> x[1] 2 1 1 5 4 6 13 11 13 101 101 101> y[1] 1.281055090 1.563609934 0.001570796 2.291579783 0.841891853 [6] 6.553951324 14.243274230 14.519899320 15.066473610 21.728809880 [11] 18.553054450 23.722637370 The model fitted was: model<-nls(y~SSgompertz(x,a,b,c)) and it worked OK, with the following results: Formula: y ~ SSgompertz(x, a, b, c) Parameters: Estimate Std. Error t value Pr(>|t|) a 21.2426 0.9689 21.924 4.03e-09 *** b 5.3330 1.4722 3.622 0.00555 ** c 0.8045 0.0274 29.364 3.01e-10 *** Then, trying to get confidence intervals for the parameters using the nlsBoot function in the nlstools package I got this error:> modelboot<-nlsBoot(model)Error en data2[, var1] <- fitted1 + sample(scale(resid1, scale = FALSE), : objeto de tipo 'environment' no es subconjunto I?ve tried with another response variable and other self starting function (SSlogis) and got the same error. Any suggestions? Francisco ---------------------- Francisco Mora Ardila Estudiante de Doctorado Centro de Investigaciones en Ecosistemas Universidad Nacional Aut?noma de M?xico
Bill Pikounis
2012-Aug-14 22:00 UTC
[R] bootstrapped CI for nonlinear models using nlsBoot from nlstools
Hello Francisco: I am not familiar with nlsBoot, but if things cannot be solved there, another option is the example shown in Chapter 8, page 225-226 of the Venables & Ripley MASS book (2002) which uses nls and the boot recommended package from R. The MASS package has a scripts subfolder for this book example application on the Stormer data set. Kind Regards, Bill On Tue, Aug 14, 2012 at 2:58 PM, Francisco Mora Ardila <fmora at oikos.unam.mx> wrote:> Hi all > > I?m trying to get confidence intervals for parameters from nls modeling. I fitted a nls > model to the following variables: > >> x > [1] 2 1 1 5 4 6 13 11 13 101 101 101 >> y > [1] 1.281055090 1.563609934 0.001570796 2.291579783 0.841891853 > [6] 6.553951324 14.243274230 14.519899320 15.066473610 21.728809880 > [11] 18.553054450 23.722637370 > > The model fitted was: > > model<-nls(y~SSgompertz(x,a,b,c)) > > and it worked OK, with the following results: > > Formula: y ~ SSgompertz(x, a, b, c) > > Parameters: > Estimate Std. Error t value Pr(>|t|) > a 21.2426 0.9689 21.924 4.03e-09 *** > b 5.3330 1.4722 3.622 0.00555 ** > c 0.8045 0.0274 29.364 3.01e-10 *** > > Then, trying to get confidence intervals for the parameters using the nlsBoot function > in the nlstools package I got this error: > >> modelboot<-nlsBoot(model) > Error en data2[, var1] <- fitted1 + sample(scale(resid1, scale = FALSE), : > objeto de tipo 'environment' no es subconjunto > > I?ve tried with another response variable and other self starting function (SSlogis) and > got the same error. > > Any suggestions? > > Francisco > > > ---------------------- > Francisco Mora Ardila > Estudiante de Doctorado > Centro de Investigaciones en Ecosistemas > Universidad Nacional Aut?noma de M?xico > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.