[R] writing new varFunc class

Richard E. Glor rglor at mail.rochester.edu
Tue Mar 13 21:28:24 CET 2007


I'm trying to use nonlinear regression to estimate model parameters  
for a constant rate birth-death process conditioned on the fact that  
the population has not gone extinct.  Because the birth and death  
parameters obtained from standard application of gnls() appear to be  
biased, I'd like to write a new varFunc class for gnls() that  
accommodates the expected increase in variance with time.  The help  
documentation for varClasses notes that "Users may define their own  
varFunc classes by specifying a constructor function and, at a  
minimum, methods for the functions coef, coef<-, and initialize. For  
examples of these functions, see the methods for class varPower.",  
but I did not find the content offered in varPower to be particularly  
helpful in this regard.  If anybody has gone through the process of  
creating a new varFunc I'd love to hear from you.  The variance  
function I'd like to construct is from Bailey 1964:

(m*exp((lambda-mu)*t)*((lambda/mu)+1)*(exp((lambda-mu)*t)-1)/((lambda/ 
mu)-1)

, where m is the starting number of individuals, lambda is the birth  
rate, mu the death rate and t the time since the population's origin.

Cheers,
Rich



More information about the R-help mailing list