lf {locfit} | R Documentation |
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.
lf(..., alpha=0.7, deg=2, scale=1, kern="tcub", ev="tree", maxk=100)
... |
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 is
a fixed component. A third component is the penalty term in locally
adaptive smoothing. |
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. If scale=FALSE (the default) no scaling
is performed. If scale=TRUE , marginal standard deviations are used.
Alternatively, a numeric vector can provide scales for the
individual variables. |
kern |
Weight function, default = "tcub" .
Other choices are "rect" , "trwt" , "tria" ,
"epan" , "bisq" and "gauss" . Choices may be restricted
when derivatives are required; e.g. for confidence bands and some
bandwidth selectors. |
ev |
Evaluation Structure, default = "tree" . Also available are
"phull" , "data" , "grid" , "kdtree" ,
"kdcenter" and "crossval" . ev="none" gives no
evaluation points, effectively producing the global parametric fit.
A vector or matrix of evaluation points can also be provided. |
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 assigment
can be increased by increasing maxk . The default is maxk=100 . |
locfit
,
locfit.raw
,
gam.lf
,
gam
# 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) }