List

Kernel Density Plot

Kernel Density Plot is a graphical tool that visually represents data distribution. By smoothing data points, it creates a continuous probability density function, helping users better understand the data distribution. SPSSAU supports the following functions:

Batch add 'titles' for plotting.

Add categorical variables (e.g., gender) to generate kernel density plots for different categories.

Users can choose different kernel functions.

The system automatically sets the bandwidth , but users can also customize one.

Data Format

The dataset includes one Category and the analysis data. Category can be omitted during analysis if not needed.

Calculation Steps

1.Data Preparation

Collect a sample dataset: x1, x2, ..., xn.

2.Select a Kernel Function

Choose an appropriate kernel function that satisfies K(x)dx=1. SPSSAU provides the following kernel functions: Uniform, Triangular, Epanechnikov, Quartic, Gaussian, and Cosine. Gaussian is the default function.

Kernel Function Formula
Uniform K(x)={12,x[1,1]0, Others 
Triangular K(x)={1|x|,x[1,1]0, Others 
Epanechnikov K(x)={34(1x2),x[1,1]0, Others 
Quartic K(x)={1516(1x2)2,x[1,1]0, Others 
Gaussian [default] K(x)=12πex22,xR.
Cosine K(x)={π4cosπ2x,x[1,1]0, Others 

3.Choose Bandwidth

Select an appropriate bandwidth (h > 0) to control the smoothness of the kernel function. The smaller the bandwidth, the less smooth the estimation. SPSSAU uses 'Silverman's Rule of Thumb' by default to calculate h:

h=(3×n4)15×min(s,IQR1.35).

  • s represents the sample standard deviation.
  • IQR represents the interquartile range.
  • n represents the sample size.
  • min selects the smaller value between the two.

4.Calculate Kernel Density Estimation

For any given x,f^(x) is defined as:

f^(x)=1nhi=1nK(xxih)

5.Plot the Kernel Density Plot

Plot f^(x) to generate the kernel density plot.