smoothers {analogue}R Documentation

Smoother plugin function for use in fitting a principal curve

Description

Functions to be used as plugins to prcurve that fit smooth functions to each variable that, when combined, give the principal curve. The functions act as wrappers to the main fitting functions, which currently include smooth.spline and gam.

Usage

smoothSpline(lambda, x, choose = TRUE, complexity, ...,
             penalty = 1, cv = FALSE, keep.data = FALSE,
             control.spar = list(low = 0))

smoothGAM(lambda, x, choose = TRUE, complexity, bs = "tp", ...,
          family = gaussian(), method = "REML", select = FALSE,
          control = gam.control())

Arguments

lambda

the current projection function; the position that each sample projects to on the current principal curve. This is the predictor variable or covariate in the smooth function.

x

numeric vector; used as the response variable in the smooth function. The principal curve algorithm fits a separate scatterplot smoother (or similar smoother) to each variable in X in turn as the response.

choose

logical; should the underlying smoother function be allowed to choose the degree of smooth complexity for each variable?

complexity

numeric; the complexity of the fitted smooth functions.

penalty, cv, keep.data, control.spar

arguments to smooth.spline.

bs, family

arguments to s.

method, select, control

arguments to gam.

...

arguments passed on the the underlying function smooth.spline and users should read that function's help page for further details.

Value

An object of class "prcurveSmoother" with the following components:

lambda

for each observations, its arc-length from the beginning of the curve.

x

numeric vector of response values.

fitted.values

numeric vector of fitted values for the observations generated from the fitted smooth function.

complexity

numeric; the degrees of freedom used for the smooth function. The exact details of what these pertain to are in the help for the respective fitting functions smooth.spline and gam.

model

the object fitted by the wrapped fitting function.

Author(s)

Gavin L. Simpson

See Also

prcurve for how these functions are used.


[Package analogue version 0.17-6 Index]