Learn R Programming

nlr (version 0.1-3)

convexpr2nlform: Convert expression to nl.form

Description

Convert two sided (or one sided) expression formula to nl.form object using derive3 from MASS library.

Usage

convexpr2nlform(form, namesdata=NULL, start, inv = NULL, name="User Defined",...)

Arguments

form

Must be one sided expression (defined by ~formula) or two sided (response~predictor), nonlinear regression function, include parameters, response and predictor variables.

namesdata

optional character vector of name of data include independent and possibly dependent in two sided fomula.

start

list of parameters, for which the gradinet and hessian will be computed.

name

A character name for the model

inv

inverse of the nonlinear functin model

...

Ane extra argument pass to nl.form

Value

nl.form object of the nonlinear regression function.

formula:

formula one sided or two sided with gradinet and hessian as attribute.

formtype:

="formula"

p:

=length(start) is number of parameters.

name:

="User Defined"

par:

=start parameters.

dependent

character vector of name of dependent variable.

independent:

character vector of name of independent variable.

origin:

=form

Details

nlr package is gradient based algorithm, is based nl.form object in which gradient and hessian is available. If a nonlinear regression model formula is one sided or two sided formula and its gradient and hessian exist, the convexpr2nlform convert it to nl.form object by calling derive3 from MASS library. Although the existence of derivative is strong assumption but using advance programs can acheive high precision computing.

References

Rizo ML 2008 Statistical Computing with R The R Series. Chapman & Hall/CRC The R Series.

See Also

nl.form, nlr

Examples

Run this code
# NOT RUN {
## The function is currently defined as
nlf=convexpr2nlform(yr ~ (a)*(exp(-b*xr)-exp(-c*xr)), start = list(a=.05,b=4.39,c=21.6))
nlf
# }

Run the code above in your browser using DataLab