Learn R Programming

locfit (version 1.5-9.10)

lf: Locfit term in Additive Model formula

Description

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

This function is designed to be used with the S-Plus gam() function. For R users, there are at least two different gam() functions available. Most current distributions of R will include the mgcv library by Simon Wood; lf() is not compatable with this function.

On CRAN, there is a gam package by Trevor Hastie, similar to the S-Plus version. lf() should be compatable with this, although it's untested.

Usage

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

Arguments

...

numeric predictor variable(s)

alpha, deg, scale, kern, ev, maxk

these are as in locfit.raw.

See Also

locfit, locfit.raw, gam.lf, gam

Examples

Run this code
if (FALSE) {  
# fit an additive semiparametric model to the ethanol data.
stopifnot(require(gam))
# The `gam' package must be attached _before_ `locfit', otherwise
# the following will not work.
data(ethanol, package = "lattice")
fit <- gam(NOx ~ lf(E) + C, data=ethanol)
op <- par(mfrow=c(2, 1))
plot(fit)
par(op)
}

Run the code above in your browser using DataLab