Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: smoother
See also: denestp

Quantlet: denxestp
Description: estimates a p-dimensional density by kernel density estimation. The computation uses WARPing.

Usage: fh = denxestp(x {,h {,K} {,v} })
Input:
x n x p matrix, the data.
h scalar or p x 1 vector, bandwidth. If not given, the rule of thumb bandwidth computed by denrotp is used (Scott's rule of thumb).
K string, kernel function on [-1,1]^p. If not given, the product Quartic kernel "qua" is used.
v m x p, values of the independent variable on which to compute the regression. If not given, a grid of length 100 (p=1), length 30 (p=2) and length 8 (p=3) is used in case of p<4. When p>=4 then v is set to x.
Output:
fh n x (p+1) or m x (p+1) matrix, the first p columns contain the grid or the sorted x[,1:p], the second column contains the density estimate on the values of the first p columns.

Note:

Example:
library("smoother")
library("plot")
;
x  = read("geyser")     ; read data
fh = denxestp(x)        ; estimate density
;
fh = setmask(fh,"surface")
plot(fh)                ; graph density estimate
setgopt(plotdisplay,1,1,"title","ROTATE!")

Result:
The kernel density estimate for the Geyser data is
computed using the Quartic kernel and bandwidth
according to Scott's rule of thumb (default).
The display shows the surface of the resulting
function.
Example:
library("smoother")
library("plot")
;
x  = read("bank2.dat")            ; read data
x  = x[,4:6]                      ; columns 4 to 6
fh = denxestp(x,1.5,"qua")        ; estimate density
;
c  =(max(fh[,4])-min(fh[,4])).*(1:4)./5 ; levels
cfh= grcontour3(fh,c,1:4)                ; contours
plot(cfh)                         ; graph contours
setgopt(plotdisplay,1,1,"title","ROTATE!")

Result:
The kernel density estimate for the last three
variables of the Swiss banknote data is computed
using the Quartic kernel and bandwidth h=1.5.
The display shows a contour plot of the resulting
function.



Author: Marlene Mueller, 990413
(C) MD*TECH Method and Data Technologies, 05.02.2006