[R] fitting model to resampled data

Michael Larkin
Wed, 29 Sep 2010 19:56:56 -0000

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]]