10.07.2015 Views

The np Package - NexTag Supports Open Source Initiatives

The np Package - NexTag Supports Open Source Initiatives

The np Package - NexTag Supports Open Source Initiatives

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

36 <strong>np</strong>udensedatdatanewdataa p-variate data frame of density evaluation points. By default, evaluation takesplace on the data provided by tdat.an optional data frame, list or environment (or object coercible to a data frame byas.data.frame) containing the variables in the model. If not found in data,the variables are taken from environment(bws), typically the environmentfrom which <strong>np</strong>udensbw was called.An optional data frame in which to look for evaluation data. If omitted, thetraining data are used.DetailsValue<strong>np</strong>udens and <strong>np</strong>udist implement a variety of methods for estimating multivariate distributions(p-variate) defined over a set of possibly continuous and/or discrete (unordered, ordered) data. <strong>The</strong>approach is based on Li and Racine (2003) who employ ‘generalized product kernels’ that admit amix of continuous and discrete datatypes.Three classes of kernel estimators for the continuous datatypes are available: fixed, adaptive nearestneighbor,and generalized nearest-neighbor. Adaptive nearest-neighbor bandwidths change witheach sample realization in the set, x i , when estimating the density at the point x. Generalizednearest-neighbor bandwidths change with the point at which the density is estimated, x. Fixedbandwidths are constant over the support of x.Data contained in the data frame tdat (and also edat) may be a mix of continuous (default),unordered discrete (to be specified in the data frame tdat using the factor command), andordered discrete (to be specified in the data frame tdat using the ordered command). Data canbe entered in an arbitrary order and data types will be detected automatically by the routine (see <strong>np</strong>for details).A variety of kernels may be specified by the user. Kernels implemented for continuous datatypesinclude the second, fourth, sixth, and eighth order Gaussian and Epanechnikov kernels, and theuniform kernel. Unordered discrete datatypes use a variation on Aitchison and Aitken’s (1976)kernel, while ordered datatypes use a variation of the Wang and van Ryzin (1981) kernel.<strong>np</strong>udens returns a <strong>np</strong>density object, similarly <strong>np</strong>udist returns a <strong>np</strong>distribution object.<strong>The</strong> generic accessor functions fitted, and se, extract estimated values and asymptotic standarderrors on estimates, respectively, from the returned object. Furthermore, the functions summaryand plot support objects of both classes. <strong>The</strong> returned objects have the following components:evalthe evaluation points.dens or dist estimation of the density (cumulative distribution) at the evaluation pointsderrstandard errors of the density (cumulative distribution) estimateslog_likelihoodlog likelihood of the density estimatesUsage IssuesIf you are using data of mixed types, then it is advisable to use the data.frame function toconstruct your i<strong>np</strong>ut data and not cbind, since cbind will typically not work as intended onmixed data types and will coerce the data to the same type.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!