Try this: growthBoot <- replicate(3, growth[sample(9,12,replace=T),], simplify = FALSE) lapply(growthBoot, nls, formula = Length ~ Linf * (1 - exp(-K * (Age - to))), start = par)
On Wed, Sep 29, 2010 at 4:56 PM, Michael Larkin <mlar...@rsmas.miami.edu>wrote: > I apologize if this comes across as confusing. I will try to explain my > situation as best I can. > > > > I have R bootstrapping my growth data for fish. It's resampling my > database > of age and length data and then produces several new datasets for me. In > this case, it's resampling my data to create three new datasets of age and > length data. Here is my code with my original data called growth: > > > > replicate(3, growth[sample(9,12,replace=T),], simplify = FALSE) > > > > This is working very well. > > > > Now, the problem that I am now stuck with is incorporating a growth model > into the three new datasets to estimate growth parameters. Since there are > now three new datasets I want to get three new estimates of the growth > parameters, essentially one from each new dataset. > > > > I am using the von Bertalanffy growth model. Here is my code: > > > > par<-list(Linf=700, K=0.20, to=-0.1) > #these are the starting values for parameters > > vb<-nls(Length~Linf*(1-exp(-K*(Age-to))), start=par, data=???) #this > is > the growth model with the parameters estimated with non linear least > > squares (nls) > > > > I tried placing my resampling function the data part of the nls function > but > it asks me for parameter estimates. > > > > Any advice would be greatly appreciated. > > > > Mike > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@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.