Next: Semi-parametric Nonlinear Regression Models Up: Non-Parametric Nonlinear Regression Models Previous: Model and Estimation

## The nnr Function

The S function for fitting a NNR model is nnr. A typical call is

    nnr(formula, func, start, data)

The first three arguments are required. formula, a two-sided formula separated by the operator ~, lists the response variable on the left side, and an expression for the function on the right side. func is a list of formulae specifying all components in . Each formula in this list has the form . For example, suppose that , and both and are modeled using cubic splines. Then
   func=list(f1(t)~list(~t, cubic(t)), f2(t)~list(~t, cubic(t)))

or
   func=list(f1(t)+f2(t)~list(~t, cubic(t)))

start, a vector or an expression, specifies the initial values for the iterative procedure.

Method for selecting smoothing parameters is specified by the argument spar. spar=v'', spar=m'' and spar=u'' correspond to GCV, GML and UBR methods respectively, with GCV as the default. Other options include correlation, weights, control, and subset. They all have the same functions as in ssr. The option method in the argument control specifies the iterative method. method=GN'' and method=NR'' correspond the Gauss-Newton and Newton-Raphson methods respectively, with the Newton-Rahson method as the default.

An object of nnr class is returned. Generic functions summary, predict and intervals can be applied to extract further information. See help files for details.

As a simple example, consider the following common form of a non-parametric regression model

 (35)

Suppose that we want to restrict as a positive function. We may use the exponential transformation or square transformation to enforce positivity. Then we can model the unconstrained function by a spline model.

For the purpose of illustration, we generate samples from model () with and . We fit using the exponential transformation in nnrfit1 and square transformation in nnrfit2. We use a cubic periodic spline to model . Figure shows the fits.

t <- seq(0,1, len=100)
y <- exp(sin(2*pi*t))+0.5*rnorm(100)
nnrfit1 <- nnr(y~exp(g(t)), func=g(u)~list(~1, periodic(u)),
start=log(abs(y)+0.001))
nnrfit2 <- nnr(y~g(t)**2, func=g(u)~list(~1, periodic(u)),
start=sqrt(abs(y)))


See Section 7 for more interesting examples.

Next: Semi-parametric Nonlinear Regression Models Up: Non-Parametric Nonlinear Regression Models Previous: Model and Estimation
Yuedong Wang 2004-05-19