Learn R Programming

locfit (version 1.1-3)

lf: Locfit term in Additive Model formula

Description

This function is used to specify a smooth term in a gam() model formula.

At the time of writing, gam is not available in R.

Usage

lf(..., alpha=0.7, deg=2, scale=1, kern="tcub", ev="tree", maxk=100)

Arguments

...
numeric predictor variable(s)
alpha
Smoothing parameter. A single number (e.g. alpha=0.7) is interpreted as a nearest neighbor fraction. With two componentes (e.g. alpha=c(0.7,1.2)), the first component is a nearest neighbor fraction, and the second component
deg
degree of polynomials to be fitted locally.
scale
A scale to apply to each variable. This is especially important for multivariate fitting, where variables may be measured in non-comparable units. It is also used to specify the frequency for ang terms. I
kern
Weight function, default = "tcub". Other choices are "rect", "trwt", "tria", "epan", "bisq" and "gauss". Choices may be restricted when derivatives are requir
ev
Evaluation Structure, default = "tree". Also available are "phull", "data", "grid", "kdtree", "kdcenter" and "crossval". ev="none" gives no evalu
maxk
Controls space assignment for evaluation structures. For the adaptive evaluation structures, it is impossible to be sure in advance how many vertices will be generated. If you get warnings about `Insufficient vertex space', Locfit's default assigmen

See Also

locfit, locfit.raw, gam.lf, gam

Examples

Run this code
# fit an additive semiparametric model to the ethanol data.
if (exists("gam")) {  # shut up R's checks
fit <- gam(NOx~lf(E)+C,data=ethanol)
plot(fit)
}

Run the code above in your browser using DataLab