The KDE Procedure

Example 52.4 Requesting Additional Output Tables

This example illustrates how to request output tables with summary statistics in addition to the default output tables. Using the same data as in the section Getting Started: KDE Procedure, the following statements request univariate and bivariate summary statistics, percentiles, and levels of the kernel density estimate:

proc kde data=bivnormal;
   bivar x y / bivstats levels percentiles unistats;
run;

The resulting output is shown in Output 52.4.1.

Output 52.4.1: Bivariate Kernel Density Estimate Tables

The KDE Procedure

Inputs
Data Set WORK.BIVNORMAL
Number of Observations Used 1000
Variable 1 x
Variable 2 y
Bandwidth Method Simple Normal Reference

Controls
  x y
Grid Points 60 60
Lower Grid Limit -11.25 -10.05
Upper Grid Limit 9.1436 9.0341
Bandwidth Multiplier 1 1

Univariate Statistics
  x y
Mean -0.075 -0.070
Variance 9.73 9.93
Standard Deviation 3.12 3.15
Range 20.39 19.09
Interquartile Range 4.46 4.51
Bandwidth 0.99 1.00

Bivariate Statistics
Covariance 8.88
Correlation 0.90

Percentiles
  x y
0.5 -7.71 -8.44
1.0 -7.08 -7.46
2.5 -6.17 -6.31
5.0 -5.28 -5.23
10.0 -4.18 -4.11
25.0 -2.24 -2.30
50.0 -0.11 -0.058
75.0 2.22 2.21
90.0 3.81 3.94
95.0 4.88 5.22
97.5 6.03 5.94
99.0 6.90 6.77
99.5 7.71 7.07

Levels
Percent Density Lower for x Upper for x Lower for y Upper for y
1 0.001181 -8.14 8.45 -8.76 8.39
5 0.003031 -7.10 7.07 -7.14 6.77
10 0.004989 -6.41 5.69 -6.49 6.12
50 0.01591 -3.64 3.96 -3.58 3.86
90 0.02388 -1.22 1.19 -1.32 0.95
95 0.02525 -0.88 0.50 -0.99 0.62
99 0.02608 -0.53 0.16 -0.67 0.30
100 0.02629 -0.19 -0.19 -0.35 -0.35


The Univariate Statistics table contains standard univariate statistics for each variable, as well as statistics associated with the density estimate. Note that the estimated variances for both x and y are fairly close to the true values of 10.

The Bivariate Statistics table lists the covariance and correlation between the two variables. Note that the estimated correlation is equal to its true value to two decimal places.

The Percentiles table lists percentiles for each variable.

The Levels table lists contours of the density corresponding to percentiles of the bivariate data, and the minimum and maximum values of each variable on those contours. For example, 5% of the observed data have a density value less than 0.0030. The minimum x and y values on this contour are –7.10 and –7.14, respectively (the Lower for x and Lower for y columns), and the maximum values are 7.07 and 6.77, respectively (the Upper for x and Upper for y columns).

You can also request Percentiles or Levels tables with specific percentiles:

proc kde data=bivnormal;
   bivar x y / levels=2.5, 50, 97.5
               percentiles=2.5, 25, 50, 75, 97.5;
run;

The resulting Percentiles and Levels tables are shown in Output 52.4.2.

Output 52.4.2: Customized Percentiles and Levels Tables

The KDE Procedure

Percentiles
  x y
2.5 -6.17 -6.31
25.0 -2.24 -2.30
50.0 -0.11 -0.058
75.0 2.22 2.21
97.5 6.03 5.94

Levels
Percent Density Lower for x Upper for x Lower for y Upper for y
2.5 0.001914 -7.79 8.11 -7.79 7.74
50.0 0.01591 -3.64 3.96 -3.58 3.86
97.5 0.02573 -0.88 0.50 -0.99 0.30