nnr {assist} | R Documentation |
Nonlinear Non-parametric Regression
Description
Fit a nonlinear nonparametric regression models with spline smoothing based on extended Gauss-Newton/Newton-Raphson and backfitting.
Usage
nnr(formula, func, spar="v", data=list(),
start=list(),verbose=FALSE, control=list())
Arguments
formula |
a model formula, with the response on the left of a |
func |
a required formula specifying the spline components necessary to estimate the non-parametric function.
On the left of a |
spar |
a character string specifying a method for choosing the smoothing parameter. "v", "m" and "u" represent GCV, GML and UBR respectively. Default is "v" for GCV. |
data |
an optional data frame. |
start |
a list of vectors or expressions which input inital values for the unknown functions. If expressions,
the argument(s) inside should be the same as in |
verbose |
an optional logical numerical value. If |
control |
an optional list of control values to be used. See nnr.control for details. |
Details
A nonlinear nonparametric model is fitted using the algorithms developed in Ke and Wang (2002).
Value
an object of class nnr
is returned, containing fitted values, fitted function values as well as
other information used to assess the estimate.
Author(s)
Chunlei Ke chunlei_ke@yahoo.com and Yuedong Wang yuedong@pstat.ucsb.edu.
References
Ke, C. and Wang, Y. (2002). Nonlinear Nonparametric Regression Models. Submitted.
See Also
nnr.control
, ssr
, print.nnr
, summary.nnr
, intervals.nnr
Examples
## Not run:
x<- 1:100/100
y<- exp(sin(2*pi*x))+0.3*rnorm(x)
fit<- nnr(y~exp(f(x)), func=list(f(u)~list(~u, cubic(u))), start=list(0))
## fit a generalized varying coefficient models
data(Arosa)
Arosa$csmonth <- (Arosa$month-0.5)/12
Arosa$csyear <- (Arosa$year-1)/45
ozone.vc.fit <- nnr(thick~f1(csyear)+exp(f2(csyear))*f3(csmonth),
func=list(f1(x)~list(~I(x-.5),cubic(x)), f2(x)~list(~I(x-.5)-1,cubic(x)),
f3(x)~list(~sin(2*pi*x)+cos(2*pi*x)-1,lspline(x,type="sine0"))),
data=Arosa[Arosa$year%%2==1,], spar="m", start=list(f1=mean(thick),f2=0,f3=sin(csmonth)),
control=list(backfit=1))
## End(Not run)