[R] bivariate case in Local Polynomials regression
andy_liaw at merck.com
Thu Mar 30 18:57:51 CEST 2006
The "local regression" in locfit _is_ local polynomial. The "local
polynomial" you usually see are fixed bandwidth smoothers (e.g., locpoly in
KernSmooth). loess() also does bivariate smoothing, and it is fitting
polynomials locally, but instead of using fixed bandwidth, it uses a fixed
proportion of the data. locfit() by default does the same thing (that's
what alpha is for, if given as a single number). However, locfit() can do
other things as well: If you specify alpha=c(b1, b2), then b1 is ignored
and b2 is taken as the fixed bandwidth to use. locfit() can even do locally
adaptive bandwidth choice (if you specify acri). The scale argument
specifies whether the predictor variables are to be scaled by their marginal
SD. See the help page for locfit.raw() for details.
If you really want to know more, Prof. Loader's book (for which the package
is support software) is indispensable.
From: yyan liu
> I am using the package "KernSmooth" to do the local
> polynomial regression. However, it seems the function
> "locpoly" can only deal with univariate covaraite. I wonder
> is there any kernel smoothing package in R can deal with
> bivariate covariates? I also checked the package "lcofit" in
> which function "lcofit" can indeed deal with bivariate case.
> The code below is an example from the its help document I
> found on http://www.locfit.info However, first, it is a
> local regression method. I am not sure how to specify the
> degree of the regression model. second, i dont know what are
> "scale" and "alpha". Are they associated with the bandwidth?
> Thanks very much!
> # a bivariate local regression with smaller smoothing
> parameter fit <- locfit(NOx~E+C, data=ethanol, scale=0, alpha=0.5)
> [[alternative HTML version deleted]]
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide!
More information about the R-help