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.

`~`

, lists the response variable on the left side,
and an expression for the function on the right
side. 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)))

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

Suppose that we want to restrict as a

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.