locfit: Local Regression, Likelihood and Density Estimation.

locfitR Documentation

Local Regression, Likelihood and Density Estimation.

Description

locfit is the model formula-based interface to the Locfit library for fitting local regression and likelihood models.

locfit is implemented as a front-end to locfit.raw. See that function for options to control smoothing parameters, fitting family and other aspects of the fit.

Usage

locfit(formula, data=sys.frame(sys.parent()), weights=1, cens=0, base=0,
       subset, geth=FALSE, ..., lfproc=locfit.raw)

Arguments

formula

Model Formula; e.g. y~lp(x) for a regression model; ~lp(x) for a density estimation model. Use of lp() on the RHS is recommended, especially when non-default smoothing parameters are used.

data

Data Frame.

weights

Prior weights (or sample sizes) for individual observations. This is typically used where observations have unequal variance.

cens

Censoring indicator. 1 (or TRUE) denotes a censored observation. 0 (or FALSE) denotes uncensored.

base

Baseline for local fitting. For local regression models, specifying a base is equivalent to using y-base as the reponse. But base also works for local likelihood.

subset

Subset observations in the data frame.

geth

Don't use.

...

Other arguments to locfit.raw() (or the lfproc).

lfproc

A processing function to compute the local fit. Default is locfit.raw(). Other choices include locfit.robust(), locfit.censor() and locfit.quasi().

Value

An object with class "locfit". A standard set of methods for printing, ploting, etc. these objects is provided.

References

Loader, C. (1999). Local Regression and Likelihood. Springer, New York.

See Also

locfit.raw

Examples

# fit and plot a univariate local regression
data(ethanol, package="locfit")
fit <- locfit(NOx ~ E, data=ethanol)
plot(fit, get.data=TRUE)

# a bivariate local regression with smaller smoothing parameter
fit <- locfit(NOx~lp(E,C,nn=0.5,scale=0), data=ethanol)
plot(fit)

# density estimation
data(geyser, package="locfit")
fit <- locfit( ~ lp(geyser, nn=0.1, h=0.8))
plot(fit,get.data=TRUE)

locfit documentation built on July 9, 2023, 5:58 p.m.

Related to locfit in locfit...