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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>np</strong>plot 65DetailsValue<strong>np</strong>plot is a general purpose plotting routine for visually exploring objects generated by the <strong>np</strong>library, such as regressions, quantile regressions, partially linear regressions, single-index models,densities and distributions.Visualizing one and two dimensional datasets is a straightforward process. <strong>The</strong> default behavior of<strong>np</strong>plot is to generate a standard 2D plot to visualize univariate data, and a perspective plot forbivariate data. When visualizing higher dimensional data, <strong>np</strong>plot resorts to plotting a series of1D slices of the data. For a slice along dimension i, all other variables at indices j ≠ i are heldconstant at the quantiles specified in the jth element of xq. <strong>The</strong> default is the median.<strong>The</strong> slice itself is evaluated on a uniformly spaced sequence of neval points. <strong>The</strong> interval of evaluationis determined by the training data. <strong>The</strong> default behavior is to evaluate from min(txdat[,i])to max(txdat[,i]). <strong>The</strong> xtrim variable allows for control over this behavior. When xtrimis set, data is evaluated from the xtrim[i]th quantile of txdat[,i] to the 1.0-xtrim[i]thquantile of txdat[,i].Furthermore, xtrim can be set to a negative value in which case it will expand the limits of theevaluation interval beyond the support of the training data, by measuring the distance betweenmin(txdat[,i]) and the xtrim[i]th quantile of txdat[,i], and extending the support bythat distance on the lower limit of the interval. <strong>np</strong>plot uses an analogous procedure to extend theupper limit of the interval.Bootstrap resampling is conducted pairwise on (y, X, Z) (i.e., by resampling from rows of the(y, X) data or (y, X, Z) data where appropriate). inid admits general heteroskedasticity of unknownform, though it does not allow for dependence. fixed conducts Kunsch’s (1988) blockbootstrap for dependent data, while geom conducts Politis and Romano’s (1994) stationary bootstrap.For consistency of the block and stationary bootstrap, the (mean) block length b should grow withthe sample size n at an appropriate rate. If b is not given, then a default growth rate of const × n 1/3is used. This rate is “optimal” under certain conditions (see Politis and Romano (1994) for moredetails). However, in general the growth rate depends on the specific properties of the DGP. Adefault value for const (3.15) has been determined by a Monte Carlo simulation using a GaussianAR(1) process (AR(1)-parameter of 0.5, 500 observations). const has been chosen such that themean square error for the bootstrap estimate of the variance of the empirical mean is minimized.Setting plot.behavior will instruct <strong>np</strong>plot what data to return. Option summary:plot: instruct <strong>np</strong>plot to just plot the data and return NULLplot-data: instruct <strong>np</strong>plot to plot the data and return the data used to generate the plots. <strong>The</strong>data will be a list of objects of the appropriate type, with one object per plot. For example,invoking <strong>np</strong>plot on 3D density data will have it return a list of three <strong>np</strong>density objects. If biaseswere calculated, they are stored in a component named biasdata: instruct <strong>np</strong>plot to generate data only and no plotsUsage 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!