[R] fitting model to resampled data

Derek Ogle DOgle at northland.edu
Wed Sep 29 22:19:40 CEST 2010


Mike,

Without completely knowing your end game with these questions and this procedure it does seem like you are "re-inventing the wheel" here.  If that is true and given the nls() fit that you are using I would suggest that you look at boot.case() in the alr3 package or nlsBoot() in the nlstools package.  I have used both of those functions with success when fitting the von Bertalanffy growth model to fish length-age data.

Some general help for fitting von Bertalanffy growth models to fish data can be found at

http://www.ncfaculty.net/dogle/fishR/gnrlex/gnrlex.html



> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Michael Larkin
> Sent: Wednesday, September 29, 2010 2:57 PM
> To: r-help at r-project.org
> Subject: [R] fitting model to resampled data
> 
> 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 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.



More information about the R-help mailing list