Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

smooth.lf

Local Regression, Likelihood and Density Estimation.


Description

smooth.lf is a simple interface to the Locfit library. The input consists of a predictor vector (or matrix) and response. The output is a list with vectors of fitting points and fitted values. Most locfit.raw options are valid.

Usage

smooth.lf(x, y, xev=x, direct=FALSE, ...)

Arguments

x

Vector (or matrix) of the independent variable(s).

y

Response variable. If omitted, x is treated as the response and the predictor variable is 1:n.

xev

Fitting Points. Default is the data vector x.

direct

Logical variable. If T, local regression is performed directly at each fitting point. If F, the standard Locfit method combining fitting and interpolation is used.

...

Other arguments to locfit.raw().

Value

A list with components x (fitting points) and y (fitted values). Also has a call component, so update() will work.

See Also

Examples

# using smooth.lf() to fit a local likelihood model.
data(morths)
fit <- smooth.lf(morths$age, morths$deaths, weights=morths$n,
                 family="binomial")
plot(fit,type="l")

# update with the direct fit
fit1 <- update(fit, direct=TRUE)
lines(fit1,col=2)
print(max(abs(fit$y-fit1$y)))

locfit

Local Regression, Likelihood and Density Estimation

v1.5-9.4
GPL (>= 2)
Authors
Catherine Loader [aut], Jiayang Sun [ctb], Lucent Technologies [cph], Andy Liaw [cre]
Initial release
2020-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.