snr {assist}R Documentation

Fit A Semi-parametric Nonlinear Regression Model


This generic function fits a Semi-parametric Nonlinear Regression Model as formulated in Ke (2000).


snr(formula, func, params, data = sys.parent(), start, 
    spar = "v", verbose = FALSE, control = list(), correlation = NULL, 
    weights = NULL) 


formula a model formula, with the response on the left of a ~ operator and on the right an expression representing the mean function with at least one unknown function appearing with a symbol, e.g. f. If "data" is present, all names except the nonparametric function(s) used in the formula should be defined as parameters or variables in the data frame.
func a list of spline formulae each specifying the spline components necessary to estimate each non-parametric function. On the left of a ~ operator of each component is the unknow function symbol(s) as well as its arguments, while the right side is a list of two components nb, an optional one-side formula for representing the null space's bases, and a required rk structure. nb and rk are similar to formula and rk in ssr. A missing nb denotes an empty null space.
params a two-sided formula specifying models for the parameters. The syntax of params in gnls is adopted. See gnls for details.
data an optional data frame containing the variables named in model, params, correlation and weights. By default the variables are taken from the environment from which snr is called.
start a numeric list with two components: "params=", a vector of the size of the length of the unknown parameters, providing inital values for the paramters, and "f=" a list of vectors or expressions which input inital values for the unknown functions. If the unknown functions appear linear in the model, the intial values then are not necessary.
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.
verbose an optional logical numerical value. If TRUE, information on the evolution of the iterative algorithm is printed. Default is TRUE.
control an optional list of control parameters. See snr.control for details.
correlation an optional corStruct as in gnls. Default is NULL, corresponding to uncorrelation.
weights an optional varFunc structure as in gnls. Default is NULL, representing equal variances.


A semi-parametric regression model is generalization of self-modeling regression, nonlinear regression and smoothing spline models, including as special cases (nonlinear) partial spline models, varying coefficients models, PP regression and some other popular models. 'snr' is implemented with an alternate iterative procedures with smoothing splines to estimate the unknown functions and general nonlinear regression to estimate parameters.


An object of class snr is returned, representing a semi-parametric nonlinear regression fit. Generic functions such as print, summary, intervals and predict have methods to show the results of the fit.


Chunlei Ke and Yuedong Wang


Ke, C. (2000). Semi-parametric Nonlinear Regression and Mixed Effects Models. PhD thesis, University of California, Santa Barbara.

Pinheiro, J.C. and Bates, D. M. (2000). Mixed-Effects Models in S and S-PLUS. Springer.

Wahba, G. (1990). Spline Models for Observational Data. SIAM, Vol. 59.

See Also

intervals.snr, predict.snr, snr.control, gnls


Arosa$csmonth <- (Arosa$month-0.5)/12
Arosa$csyear <- (Arosa$year-1)/45
# fit a simple sin-cos model
ozone.fit1 <- lm(thick~sin(2*pi*csmonth)+cos(2*pi*csmonth), data=Arosa)

# get start values
tmp <- atan(-ozone.fit1$coef[3]/ozone.fit1$coef[2])/(2*pi)
tmp <- log(tmp/(1-tmp))

# fit a SNR model
ozone.fit2 <- snr(thick~f1(csyear)+f2(csyear)*cos(2*pi*(csmonth+alogit(a))),
                   func=list(f1(x)+f2(x)~list(~x, cubic(x))), params=list(a~1),
                   data=Arosa, start=list(params=c(tmp)), spar="m")

[Package Contents]