Learn R Programming

devRate (version 0.1.1)

devRateModel: Compute non-linear regression

Description

Determine the nonlinear least-squares estimates of the parameters of a nonlinear model, on the basis of the nls function from package stats.

Usage

devRateModel(eq, temp, devRate, startValues, ...)

Arguments

eq
The name of the equation.
temp
The temperature.
devRate
The developmental rate (days)^-1
startValues
Starting values for the regression.
...
Additional arguments for the nls function.

Value

An object of class nls (except for Stinner et al. 1974 and Lamb 1992 where the function returns a list of two objects of class nls).

Details

startValues for equations by Stinner et al. 1974 and Lamb 1992 are composed of two equations: one for the temperatures below the optimal temperature and another for the tamperatures above the optimal temperature. For these equations, startValues should be a list of two lists, where the second element only contain starting estimates not specified in the first element, e.g., for Stinner et al.: startValues <- list(list(C = 0.05, k1 = 5, k2 = -0.3), list(Topt = 30)), and for Lamb 1992: startValues <- list(list(Rm = 0.05, Tmax = 35, To = 15), list(T1 = 4))

Examples

Run this code
myT <- 5:15
myDev <- -0.05 + rnorm(n = length(myT), mean = myT, sd = 1) * 0.01
myNLS <- devRateModel(eq = campbell_74, temp = myT, devRate = myDev,
  startValues = list(aa = 0, bb = 0))
myT <- seq(from = 0, to = 50, by = 10)
myDev <- c(0.001, 0.008, 0.02, 0.03, 0.018, 0.004)
myNLS <- devRateModel(eq = stinner_74, temp = myT, devRate = myDev,
  startValues = list(list(C = 0.05, k1 = 5, k2 = -0.3), list(Topt = 30)))

Run the code above in your browser using DataLab