locpoly(x, y, drv=0, degree=<<see below>>, kernel="normal", bandwidth, gridsize=401, bwdisc=25, range.x=<<see below>>, binned=F, truncate=T)
x
| vector of x data. Missing values are not accepted. |
bandwidth
|
the kernel bandwidth smoothing parameter.
It may be a single number or an array having
length gridsize , representing a bandwidth
that varies according to the location of
estimation.
|
y
|
vector of y data.
This must be same length as x , and
missing values are not accepted.
|
drv
| order of derivative to be estimated. |
degree
|
degree of local polynomial used. Its value
must be greater than or equal to the value
of drv . The default value is of degree is
drv + 1.
|
kernel
|
"normal" - the Gaussian density function.
|
gridsize
| number of equally-spaced grid points over which the function is to be estimated. |
bwdisc
|
number of logarithmically-equally-spaced bandwidths
on which bandwidth is discretised, to speed up
computation.
|
range.x
|
vector containing the minimum and maximum values of x at which to
compute the estimate.
|
binned
|
logical flag: if TRUE , then x and y are taken to be grid counts
rather than raw data.
|
truncate
|
logical flag: if TRUE , data with x values outside the range specified
by range.x are ignored.
|
y
is specified, a local polynomial regression estimate of
E[Y|X] (or its derivative) is computed.
If y
is missing, a local polynomial estimate of the density
of x
(or its derivative) is computed.
a list containing the following components:
x
| vector of sorted x values at which the estimate was computed. |
y
|
vector of smoothed estimates for either the density or the regression
at the corresponding x .
|
gridsize
.bkde
, density
, dpill
, ksmooth
, loess
, smooth
, supsmu
.data(geyser) x <- geyser$duration est <- locpoly(x,bandwidth=0.25) plot(est,type="l") # local linear density estimate y <- geyser$waiting plot(x,y) fit <- locpoly(x,y,bandwidth=0.25) lines(fit) # local linear regression estimate