Description Usage Arguments Details Value References See Also Examples

Estimates conditional density functions of the form f(y| x) = f(x,y)/f(x). Kernel density estimators are used to estimate f(x,y) and f(x). The conditional density function can be plotted as a three-dimensional surface or as a contour map. Alternatively, the conditional density of y can be graphed for as many as five target values of x.

1 2 3 4 |

`form` |
Model formula |

`window ` |
Window size. Default: 0.25. |

`bandwidth ` |
Bandwidth. Default: not used. |

`kern` |
Kernel weighting functions. Default is the tri-cube. Options include "rect", "tria", "epan", "bisq", "tcub", "trwt", and "gauss". |

```
mingrid.x, maxgrid.x, mingrid.y, maxgrid.y,
ngrid
``` |
The mingrid and maxgrid values are the boundaries for the |

`xlab` |
Label for the |

`ylab` |
Label for the |

`zlab` |
Label for the |

`contour` |
If |

`level` |
If |

`wire` |
If |

`dens` |
If |

`targetx.dens` |
Target values for |

`quantile.dens` |
Quantiles for the target values for |

`data ` |
A data frame containing the data. Default: use data in the current working directory. |

The *locfit* package is used to find the target values of *x* for *f(x)* and *y* for *f(y)*.
The *expand.grid* command is then used to determine the target values of *x* and *y* for *f(x,y)*.
The *smooth12* command is used to interpolate *f(x)*, *f(y)*, and *f(x,y)* to the
full data set and to the grid of target values for the contour, level, and wire plots.

The density functions *f(x)* and *f(y)* are as follows:

*(sd(x)*b)^{-1} mean((x_i - x)/(sd(x)*b)) *

*(sd(y)*b)^{-1} mean((y_i - y)/(sd(y)*b)) *

A product kernel is used for *f(x,y)*:

*(sd(x)*b*sd(y)*b)^{-1} mean (K ( (x_i - x)/(sd(x)*b) ) K ( (y_i - y)/(sd(y)*b) ) *

where *b* is the bandwidth and the target points are *x* and *y*.
The bandwidth, *b*, can be set using the *bandwidth* option.
If *b* = 0 (the default), *sd(x)*b* and *sd(y)*b* are replaced by window values, *h = quantile(dist, window)*,
where *dist = |x_i - x|* or *dist = |y_i - y|*.
The window size is set using the *window* option. By default, *window* = .7 and *bandwidth* = 0.
Available kernel weighting functions include the following:

Kernel | Call abbreviation | Kernel function K(z) |

Rectangular | ``rect'' | 1/2 * I(|z|<1) |

Triangular | ``tria'' | (1-|z|) * I(|z|<1) |

Epanechnikov | ``epan'' | 3/4 * (1-z^2)*I(|z| < 1) |

Bi-Square | ``bisq'' | 15/16 * (1-z^2)^2 * I(|z| < 1) |

Tri-Cube | ``tcub'' | 70/81 * (1-|z|^3)^3 * I(|z| < 1) |

Tri-Weight | ``trwt'' | 35/32 * (1-z^2)^3 * I(|z| < 1) |

Gaussian | ``gauss'' | 2pi^{-.5} exp(-z^2/2) |

The contour, level, and wire plots are produced from the values in *gridmat* using the *lattice* package.
The two-dimensional density graphs produced when *dens=TRUE* are plots of *f(y,x)/f(x)* at given values of *x*.
By default, the values for *x* are the quantiles given in *quantile.dens*.
Alternatively, the values of *x* can be specified directly using the *targetx.dens* option.
The values used to construct the density graphs are stored in *densmat*.
Both *gridmat* and *densmat* are stored by *condens* even if the printing of the graphs is suppressed.

`fx` |
The values of |

`fy` |
The values of |

`fxy` |
The values of |

`gridmat` |
An ( |

`densmat` |
The estimated values of |

Li, Oi and Jeffrey Scott Racine. *Nonparametric Econometrics: Theory and Practice.* Princeton, NJ: Princeton University Press, 2007.

Loader, Clive. *Local Regression and Likelihood.* New York: Springer, 1999.

Pagan, Adrian and Aman Ullah. *Nonparametric Econometrics.* New York: Cambridge University Press, 1999.

qregcdf

1 2 3 4 5 6 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.