The S function for fitting a SNR model is `snr`.
A typical call is

snr(formula, func, params, start, data)The first four arguments are required. Arguments

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`, and
`control`. They all have the same function
as in `ssr`.

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

**Example 9**. *Projection Pursuit models* assume that
.
They are also known as the multiple index models. Note that our
estimation procedure is similar to that used in Roosen and Hastie (1994).
For example, suppose that , , and both and
are modeled using TPS on with . Instead of
polynomial splines, we use TPS's to avoid the limitation on the
domain. For identifiability, we need the side condition
. We can fit such a model
by

snr(y~f1(a11*t1+a12*t2+sqrt(1-a11**2-a12**2)*t3) + f2(a21*t1+a22*t2+sqrt(1-a21**2-a22**2)*t3), func=list(f1(z)+f2(z)~list(~z,rk=tp.pseudo(z)), params=list(a11+a12+a21+a22~1), start=c(a110,a120,a210,a220))

**Example 10**. *Nonlinear partial splines* assume that
, where is
a known function depends nonlinearly on parameters
.
For example, suppose that
,
is a function of modeled using a periodic spline,
and
. we can fit such
a model by

snr(y~f(t1)+a*exp(b*t2), func=list(f(z)~list(~1,rk=periodic(z)), params=list(a+b~1), start=c(a0,b0))The function can also be input as an outside S function as in

**Example 11**. *Monotone spline*. Consider model ()
where is assumed to be a strictly increasing function.
Nychka and Ruppert (1995) used the following transformation

where . We can fit such a model by

snr(y~a+h(g), func=list(g(z)~list(~z,rk=cubic(z)), params=list(a~1), start=c(a0))where is an S function calculating the integral .

For monotone (either increasing or decreasing),
Ramsay (1998) suggested the following transformation

where . We can fit such a model by

snr(y~a+b*h(g), func=list(g(z)~list(~z,rk=cubic(z))), params=list(a~1,b~1), start=c(a0,b0))where is a S function calculating the integral .

**Example 12**. *Positive monotone spline*. Consider
model () where is assumed to be a strictly
positive and increasing function. One may use the following
transformation

where . We can fit such a model by

snr(y~exp(a+h(g)), func=list(g(z)~list(~z,rk=cubic(z)), params=list(a~1), start=c(a0))where is a S function calculating the integral .

**Example 13**. *Varying coefficient models*.
Suppose that
. The varying coefficient
models in Hastie and Tibshirani (1993) assume that

Suppose that , both and are univariate functions of a continuous variable and are modeled using cubic splines. We can fit such a model by

snr(y~a+f1(z)*x1+f2(z)*x2, func=list(f1(z)+f2(z)~list(~z,cubic(z))), params=list(a~1), start=c(a0))

**Example 14**. *Self-modeling nonlinear regression
(SEMOR)* models were first proposed by Lawton et al. (1972)
to fit repeated measures data. They assumed that there exists
a *common* curve for all subjects and that a
particular subject's response curve is some parametric
transformation of the common curve. We consider a more
general SEMOR model

where , and are known functions of with unknown parameters . Usually is a continuous variable such as time. is a function of a univariate continuous variable. Depending on the range of , polynomial splines or univariate TPS may be used to model . Most often, a SEMOR model is in the form of

Model () is referred to as a shape invariant model (SIM). Suppose we model with a TPS on with and random errors are iid normal. Note that we used exponential transformation to force the amplitude parameter and the scale parameter to be positive. It is clear that model () is not identifiable without side conditions. We now illustrate two approaches to make it identifiable. The first approach uses the following side conditions: . Correspondingly these set-to-zero conditions free from confounding with a vertical shift, a vertical stretch, a horizontal shift and a horizontal stretch. Then model () can be fitted by

snr(y~a1+exp(a2)*f((t-a3)/exp(a4)), func=list(f(z)~list(~z,tp.pseudo(z))), params=list(a1+a2+a3+a4~subject-1), start=c(a10,a20,a30,a40))

We may also impose side conditions on . For example, we may remove the constant functions from the model space of to make it identifiable with 's. We may use the constraint to make identifiable with 's. Under these alternative side conditions and , model () can be fitted by

snr(y~a1+exp(a2)*f((t-a3)/exp(a4)), func=list(f(z)~list(~z-1,tp.pseudo(z))), params=list(a1+a2~subject,a3+a4~subject-1), start=c(a10,a20,a30,a40), constraint=list(maxValue=1))Note that the ``constraint'' option is not available in the current version.