EVOLUTION-MANAGER
Edit File: locpoly.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Estimate Functions Using Local Polynomials</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for locpoly {KernSmooth}"><tr><td>locpoly {KernSmooth}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Estimate Functions Using Local Polynomials </h2> <h3>Description</h3> <p>Estimates a probability density function, regression function or their derivatives using local polynomials. A fast binned implementation over an equally-spaced grid is used. </p> <h3>Usage</h3> <pre> locpoly(x, y, drv = 0L, degree, kernel = "normal", bandwidth, gridsize = 401L, bwdisc = 25, range.x, binned = FALSE, truncate = TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>numeric vector of x data. Missing values are not accepted. </p> </td></tr> <tr valign="top"><td><code>bandwidth</code></td> <td> <p>the kernel bandwidth smoothing parameter. It may be a single number or an array having length <code>gridsize</code>, representing a bandwidth that varies according to the location of estimation. </p> </td></tr> <tr valign="top"><td><code>y</code></td> <td> <p>vector of y data. This must be same length as <code>x</code>, and missing values are not accepted. </p> </td></tr> <tr valign="top"><td><code>drv</code></td> <td> <p>order of derivative to be estimated. </p> </td></tr> <tr valign="top"><td><code>degree</code></td> <td> <p>degree of local polynomial used. Its value must be greater than or equal to the value of <code>drv</code>. The default value is of <code>degree</code> is <code>drv</code> + 1. </p> </td></tr> <tr valign="top"><td><code>kernel</code></td> <td> <p><code>"normal"</code> - the Gaussian density function. Currently ignored. </p> </td></tr> <tr valign="top"><td><code>gridsize</code></td> <td> <p>number of equally-spaced grid points over which the function is to be estimated. </p> </td></tr> <tr valign="top"><td><code>bwdisc</code></td> <td> <p>number of logarithmically-equally-spaced bandwidths on which <code>bandwidth</code> is discretised, to speed up computation. </p> </td></tr> <tr valign="top"><td><code>range.x</code></td> <td> <p>vector containing the minimum and maximum values of <code>x</code> at which to compute the estimate. </p> </td></tr> <tr valign="top"><td><code>binned</code></td> <td> <p>logical flag: if <code>TRUE</code>, then <code>x</code> and <code>y</code> are taken to be grid counts rather than raw data. </p> </td></tr> <tr valign="top"><td><code>truncate</code></td> <td> <p>logical flag: if <code>TRUE</code>, data with <code>x</code> values outside the range specified by <code>range.x</code> are ignored. </p> </td></tr></table> <h3>Value</h3> <p>if <code>y</code> is specified, a local polynomial regression estimate of E[Y|X] (or its derivative) is computed. If <code>y</code> is missing, a local polynomial estimate of the density of <code>x</code> (or its derivative) is computed. </p> <p>a list containing the following components: </p> <table summary="R valueblock"> <tr valign="top"><td><code>x</code></td> <td> <p>vector of sorted x values at which the estimate was computed. </p> </td></tr> <tr valign="top"><td><code>y</code></td> <td> <p>vector of smoothed estimates for either the density or the regression at the corresponding <code>x</code>. </p> </td></tr></table> <h3>Details</h3> <p>Local polynomial fitting with a kernel weight is used to estimate either a density, regression function or their derivatives. In the case of density estimation, the data are binned and the local fitting procedure is applied to the bin counts. In either case, binned approximations over an equally-spaced grid is used for fast computation. The bandwidth may be either scalar or a vector of length <code>gridsize</code>. </p> <h3>References</h3> <p>Wand, M. P. and Jones, M. C. (1995). <em>Kernel Smoothing.</em> Chapman and Hall, London. </p> <h3>See Also</h3> <p><code><a href="bkde.html">bkde</a></code>, <code><a href="../../stats/html/density.html">density</a></code>, <code><a href="dpill.html">dpill</a></code>, <code><a href="../../stats/html/ksmooth.html">ksmooth</a></code>, <code><a href="../../stats/html/loess.html">loess</a></code>, <code><a href="../../stats/html/smooth.html">smooth</a></code>, <code><a href="../../stats/html/supsmu.html">supsmu</a></code>. </p> <h3>Examples</h3> <pre> data(geyser, package = "MASS") # local linear density estimate x <- geyser$duration est <- locpoly(x, bandwidth = 0.25) plot(est, type = "l") # local linear regression estimate y <- geyser$waiting plot(x, y) fit <- locpoly(x, y, bandwidth = 0.25) lines(fit) </pre> <hr /><div style="text-align: center;">[Package <em>KernSmooth</em> version 2.23-15 <a href="00Index.html">Index</a>]</div> </body></html>