Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • System Modeler

    Multidomain modeling and simulation of complex systems

  • Compute ServicesUse with Mathematica and Wolfram|One
  • AI AccessUse with Mathematica and Wolfram|One
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Wolfram|Alpha

  • Wolfram|Alpha Website
  • Wolfram|Alpha APIs

AI Products

  • Wolfram AI Ecosystem
  • Wolfram Foundation Tool
  • Wolfram Cloud MCP
  • Wolfram Local MCP
  • Agent One API
  • CAG Component APIs

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • Linguistic Understanding

Additional Deployment Options

  • Wolfram Cloud
  • Wolfram Web Engine
  • wolframscript
  • WSTPServer
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI eraβ€”combining symbolic computation, data-driven insights and deep technical expertise

Wolfram Consulting

Data Science, Finance & Business

  • Artificial Intelligence
  • Data Science
  • Healthcare
  • Real Estate

Engineering

  • Civil Engineering
  • Automotive Engineering
  • Sustainable Energy

Science & Technology

  • AgTech
  • Biosciences
  • Environmental Science
  • Food Science
  • Quantum Computation
  • Social and Behavioral Sciences

More Wolfram Solutions

Technology for Education

  • Research Universities
  • Colleges & Teaching Universities
  • High Schools
  • Resources for Students

Education Initiatives

  • Next-Gen EdTech
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
For AIs
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • System Modeler
    • Compute ServicesUse with Mathematica and Wolfram|One
    • AI AccessUse with Mathematica and Wolfram|One
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Wolfram|Alpha
      • Wolfram|Alpha Website
      • Wolfram|Alpha APIs
    • AI Products
      • Wolfram AI Ecosystem
      • Wolfram Foundation Tool
      • Wolfram Cloud MCP
      • Wolfram Local MCP
      • Agent One API
      • CAG Component APIs
    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • Linguistic Understanding
    • Additional Deployment Options
      • Wolfram Cloud
      • Wolfram Web Engine
      • wolframscript
      • WSTPServer
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions
    • Wolfram Consulting

    Data Science, Finance & Business

    • Artificial Intelligence
    • Data Science
    • Healthcare
    • Real Estate

    Engineering

    • Civil Engineering
    • Automotive Engineering
    • Sustainable Energy

    Science & Technology

    • AgTech
    • Biosciences
    • Environmental Science
    • Food Science
    • Quantum Computation
    • Social and Behavioral Sciences

    More Wolfram Solutions

    Technology for Education

    • Research Universities
    • Colleges & Teaching Universities
    • High Schools
    • Resources for Students

    Education Initiatives

    • Next-Gen EdTech
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • For AIs
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
SmoothKernelDistribution
  • See Also
    • KernelMixtureDistribution
    • HistogramDistribution
    • EmpiricalDistribution
    • SurvivalDistribution
    • EstimatedDistribution
    • FindDistribution
  • Related Guides
    • Probability & Statistics with Quantities
    • Nonparametric Statistical Distributions
    • Probability & Statistics
    • Random Variables
    • Tabular Modeling
    • Unsupervised Machine Learning
    • Survival Analysis
    • See Also
      • KernelMixtureDistribution
      • HistogramDistribution
      • EmpiricalDistribution
      • SurvivalDistribution
      • EstimatedDistribution
      • FindDistribution
    • Related Guides
      • Probability & Statistics with Quantities
      • Nonparametric Statistical Distributions
      • Probability & Statistics
      • Random Variables
      • Tabular Modeling
      • Unsupervised Machine Learning
      • Survival Analysis

SmoothKernelDistribution[{x1,x2,…}]

represents a smooth kernel distribution based on the data values xi.

SmoothKernelDistribution[{{x1,y1,…},{x2,y2,…},…}]

represents a multivariate smooth kernel distribution based on the data values {xi,yi,…}.

SmoothKernelDistribution[…,bw]

represents a smooth kernel distribution with bandwidth bw.

SmoothKernelDistribution[…,bw,ker]

represents a smooth kernel distribution with bandwidth bw and smoothing kernel ker.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Basic Uses  
Distribution Properties  
Bandwidth Selection  
Kernel Functions  
Estimation with Fixed Domain  
Options  
InterpolationPoints  
MaxExtraBandwidths  
MaxMixtureKernels  
MaxRecursion  
PerformanceGoal  
Applications  
Properties & Relations  
Possible Issues  
Neat Examples  
See Also
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • KernelMixtureDistribution
    • HistogramDistribution
    • EmpiricalDistribution
    • SurvivalDistribution
    • EstimatedDistribution
    • FindDistribution
  • Related Guides
    • Probability & Statistics with Quantities
    • Nonparametric Statistical Distributions
    • Probability & Statistics
    • Random Variables
    • Tabular Modeling
    • Unsupervised Machine Learning
    • Survival Analysis
    • See Also
      • KernelMixtureDistribution
      • HistogramDistribution
      • EmpiricalDistribution
      • SurvivalDistribution
      • EstimatedDistribution
      • FindDistribution
    • Related Guides
      • Probability & Statistics with Quantities
      • Nonparametric Statistical Distributions
      • Probability & Statistics
      • Random Variables
      • Tabular Modeling
      • Unsupervised Machine Learning
      • Survival Analysis

SmoothKernelDistribution

SmoothKernelDistribution[{x1,x2,…}]

represents a smooth kernel distribution based on the data values xi.

SmoothKernelDistribution[{{x1,y1,…},{x2,y2,…},…}]

represents a multivariate smooth kernel distribution based on the data values {xi,yi,…}.

SmoothKernelDistribution[…,bw]

represents a smooth kernel distribution with bandwidth bw.

SmoothKernelDistribution[…,bw,ker]

represents a smooth kernel distribution with bandwidth bw and smoothing kernel ker.

Details and Options

  • SmoothKernelDistribution returns a DataDistribution object that can be used like any other probability distribution.
  • The probability density function for SmoothKernelDistribution for a value is given by a linearly interpolated version of for a smoothing kernel and bandwidth parameter .
  • The following bandwidth specifications bw can be given:
  • hbandwidth to use
    {"Standardized",h}bandwidth in units of standard deviations
    {"Adaptive",h,s}adaptive with initial bandwidth h and sensitivity s
    Automaticautomatically computed bandwidth
    "name"use a named bandwidth selection method
    {bwx,bwy,…}separate bandwidth specifications for x, y, etc.
  • For multivariate densities, h can be a positive definite symmetric matrix.
  • For adaptive bandwidths, the sensitivity s must be a real number between 0 and 1 or Automatic. If Automatic is used, s is set to , where is the dimensionality of the data.
  • Possible named bandwidth selection methods include:
  • "LeastSquaresCrossValidation"use the method of least-squares cross-validation
    "Oversmooth"1.08 times wider than the standard Gaussian
    "Scott"use Scott's rule to determine bandwidth
    "SheatherJones"use the Sheather–Jones plugin estimator
    "Silverman"use Silverman's rule to determine bandwidth
    "StandardDeviation"use the standard deviation as bandwidth
    "StandardGaussian"optimal bandwidth for standard normal data
  • By default, the "Silverman" method is used.
  • For automatic bandwidth computation, constant arrays are assumed to have unit variance.
  • The following kernel specifications ker can be given:
  • "Biweight"
    "Cosine"
    "Epanechnikov"
    "Gaussian"
    "Rectangular"
    "SemiCircle"
    "Triangular"
    "Triweight"
    funcf_nu in R
  • In order for SmoothKernelDistribution to generate a true density estimate, the function fn should be a valid probability density function.
  • By default, the "Gaussian" kernel is used.
  • The kernel function ker can be specified to account for known bounding on the underlying density using {"Bounded",c,ker}, where c can be any real number, a list {c1,c2} such that c1<c2, or a list {{c11,c12},{c21,c22},…}, with length equal to the dimension of data.
  • For multivariate densities, the kernel function ker can be specified as product and radial types using {"Product",ker} and {"Radial",ker}, respectively. Product-type kernels are used if no type is specified.
  • The precision used for density estimation is the minimum precision given in the bw and data.
  • The following options can be given:
  • InterpolationPoints Automaticinitial number of interpolation points to use
    MaxMixtureKernels Automaticmax number of kernels to use
    MaxRecursion Automaticnumber of recursive subdivisions to allow
    PerformanceGoal Automaticoptimize for speed or quality
    MaxExtraBandwidths Automaticmax bandwidths beyond data to use
  • SmoothKernelDistribution can be used with such functions as Mean, CDF, and RandomVariate.

Examples

open all close all

Basic Examples  (2)

Create an interpolated version of a kernel density estimate for some univariate data:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10 ^ 3];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data];

Use the resulting distribution to perform analysis, including visualizing distribution functions:

Wolfram Language code: Table[Plot[f[π’Ÿ, x], {x, -4, 4}, PlotLabel -> f], {f, {PDF, CDF}}]

Compute moments and quantiles:

Wolfram Language code: Moment[π’Ÿ, 2]
Wolfram Language code: Quantile[π’Ÿ, 0.95]

Create an interpolated version of a kernel density estimate of some bivariate data:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.75], 10];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data];

Visualize the estimated PDF and CDF:

Wolfram Language code: Table[ContourPlot[f[π’Ÿ, {x, y}], {x, -3, 3}, {y, -3, 3}, PlotLabel -> f, PlotRange -> All], {f, {PDF, CDF}}]

Compute covariance and general moments:

Wolfram Language code: Covariance[π’Ÿ]//MatrixForm
Wolfram Language code: Moment[π’Ÿ, {1, 2}]

Scope  (37)

Basic Uses  (7)

Create an interpolated smooth density estimate for some data:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10^4];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data];
Wolfram Language code: Show[Histogram[data, Automatic, "PDF"], Plot[PDF[π’Ÿ, x], {x, -4, 4}]]

Compute probabilities from the distribution:

Wolfram Language code: Probability[x > 3, xο’π’Ÿ]

Create an interpolated version of a kernel density estimate for data with quantities:

Wolfram Language code: data = QuantityArray[RandomVariate[NormalDistribution[1, 2.5], 10 ^ 4], "Meters"]
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data]

Find moments:

Wolfram Language code: #[π’Ÿ]& /@ {Mean, Variance, Skewness, Kurtosis}

Increase the bandwidth for smoother estimates:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 5];
Wolfram Language code: bw = {.1, .2, .5, 1.0};
Wolfram Language code: Table[Plot[PDF[SmoothKernelDistribution[data, i], x]//Evaluate, {x, -4, 4}, PlotLabel -> Row[{"bandwidth = ", i}], PlotRange -> {0, 1.6}, Filling -> Axis], {i, bw}]

Allow the bandwidth to vary adaptively with local density:

Wolfram Language code: data = RandomVariate[𝒹 = MixtureDistribution[{1, 2}, {NormalDistribution[], NormalDistribution[2, 1 / 2]}], 10^4];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, {"Adaptive", Automatic, .5}];
Wolfram Language code: Plot[{PDF[𝒹, x], PDF[π’Ÿ, x]}, {x, -4, 4}, PlotLegends -> {"𝒹", "π’Ÿ"}]

Interpolate kernel density estimates in higher dimensions:

Wolfram Language code: data = RandomVariate[NormalDistribution[], {10, 3}];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, .5];

Plot the univariate marginal PDFs:

Wolfram Language code: Table[Plot[Evaluate[PDF[MarginalDistribution[π’Ÿ, i], x]], {x, -4, 4}, PlotLabel -> i], {i, {1, 2, 3}}]

Plot the bivariate marginal PDFs:

Wolfram Language code: Table[Plot3D[Evaluate[PDF[MarginalDistribution[π’Ÿ, i], {x, y}]], {x, -4, 4}, {y, -4, 4}, PlotRange -> All, PlotLabel -> i], {i, Subsets[{1, 2, 3}, {2}]}]

Select from built-in kernel functions or build a custom one:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 100];
Wolfram Language code: kerns = {"Gaussian", "Rectangular", "Triangular"};
Wolfram Language code: π’Ÿs = Table[SmoothKernelDistribution[data, Automatic, k], {k, kerns}];
Wolfram Language code: MapThread[Plot[PDF[#1, x], {x, -4, 4}, Exclusions -> None, PlotLabel -> #2]&, {π’Ÿs, kerns}]

A custom kernel function:

Wolfram Language code: π’Ÿcustom = SmoothKernelDistribution[data, Automatic, PDF[NormalDistribution[], #]&];
Wolfram Language code: Plot[PDF[π’Ÿcustom, x], {x, -4, 4}]

Specify radial- or product-type kernels for multivariate estimates:

Wolfram Language code: data = RandomVariate[BinormalDistribution[2 / 5], 250];
Wolfram Language code: kernel = PDF[CauchyDistribution[0, 1], #]&;
Wolfram Language code: π’Ÿ = Table[SmoothKernelDistribution[data, {{1, .25}, {.25, 1}}, k], {k, {{"Radial", kernel}, {"Product", kernel}}}];
Wolfram Language code: Table[Plot3D[PDF[i, {x, y}]//Evaluate, {x, -5, 5}, {y, -5, 5}, PlotRange -> All, Exclusions -> None, MeshFunctions -> (#3&)], {i, π’Ÿ}]

Distribution Properties  (8)

Estimate distribution functions:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[RandomVariate[NormalDistribution[], 1000]];
Wolfram Language code: Table[Plot[f[π’Ÿ, x], {x, -4, 4}, Filling -> Axis, PlotLabel -> f, Exclusions -> None], {f, {PDF, CDF, HazardFunction, SurvivalFunction}}]

Compute moments of the distribution:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[RandomReal[NormalDistribution[], 1000]];

Special moments:

Wolfram Language code: {Mean[π’Ÿ], Variance[π’Ÿ], Skewness[π’Ÿ], Kurtosis[π’Ÿ]}

General moments:

Wolfram Language code: Table[Moment[π’Ÿ, k], {k, 4}]
Wolfram Language code: Table[CentralMoment[π’Ÿ, k], {k, 4}]
Wolfram Language code: Table[Cumulant[π’Ÿ, k], {k, 4}]
Wolfram Language code: Table[FactorialMoment[π’Ÿ, k], {k, 4}]

Quantile function:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[RandomReal[NormalDistribution[], 1000]];
Wolfram Language code: Plot[Quantile[π’Ÿ, p], {p, 0, 1}, Filling -> Axis, Exclusions -> None]

Special quantile values:

Wolfram Language code: Quartiles[π’Ÿ]
Wolfram Language code: InterquartileRange[π’Ÿ]
Wolfram Language code: Quantile[π’Ÿ, {0.05, 0.95}]
Wolfram Language code: Median[π’Ÿ]

Generate random numbers:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[RandomVariate[NormalDistribution[], 1000]];
Wolfram Language code: RandomVariate[π’Ÿ, 10]

Compare with SmoothKernelDistribution:

Wolfram Language code: Show[Histogram[RandomVariate[π’Ÿ, 10^4], Automatic, "PDF"], Plot[PDF[π’Ÿ, x], {x, -4, 4}]]

Compute probabilities and expectations:

Wolfram Language code: data = RandomReal[NormalDistribution[], 1000];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data];
Wolfram Language code: NProbability[x > 2, xο’π’Ÿ]
Wolfram Language code: NExpectation[x ^ 2 + 3x + 5, xο’π’Ÿ]

Estimate bivariate distribution functions:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[RandomVariate[BinormalDistribution[.75], 100]];
Wolfram Language code: Table[DiscretePlot3D[Evaluate[f[π’Ÿ, {x, y}]], {x, -4, 4, .5}, {y, -4, 4, .5}, PlotLabel -> f, ExtentSize -> 1 / 2], {f, {PDF, CDF, HazardFunction, SurvivalFunction}}]

Compute moments of a bivariate distribution:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[RandomReal[BinormalDistribution[.75], 1000]];

Special moments:

Wolfram Language code: {Mean[π’Ÿ], Variance[π’Ÿ]}
Wolfram Language code: Covariance[π’Ÿ]//MatrixForm
Wolfram Language code: Correlation[π’Ÿ]//MatrixForm

General moments:

Wolfram Language code: Moment[π’Ÿ, {1, 2}]
Wolfram Language code: CentralMoment[π’Ÿ, {1, 2}]
Wolfram Language code: Cumulant[π’Ÿ, {1, 2}]
Wolfram Language code: FactorialMoment[π’Ÿ, {1, 2}]

Generate random numbers:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[RandomReal[BinormalDistribution[.5], 10 ^ 2]];
Wolfram Language code: RandomVariate[π’Ÿ, 6]

Show the point distribution:

Wolfram Language code: ListPlot[RandomVariate[π’Ÿ, 10^4], PlotRange -> {{-4, 4}, {-4, 4}}]

Bandwidth Selection  (12)

Automatically select the bandwidth to use:

Wolfram Language code: data1 = RandomVariate[𝒹 = NormalDistribution[], 10]; data2 = RandomVariate[𝒹, 10 ^ 4];
Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data1]; π’Ÿ2 = SmoothKernelDistribution[data2];

More data yields better approximations to the underlying distribution:

Wolfram Language code: Table[Plot[{PDF[π’Ÿ, x], PDF[𝒹, x]}, {x, -4, 4}, Filling -> Axis, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

Explicitly specify the bandwidth to use:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10 ^ 3];

Use bandwidths of 0.1 and 1:

Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, 0.1]; π’Ÿ2 = SmoothKernelDistribution[data, 1.0];

Larger bandwidths yield smoother estimates:

Wolfram Language code: Table[Plot[PDF[π’Ÿ, x], {x, -4, 4}, Filling -> Axis, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

Specify bandwidths in units of standard deviation:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10 ^ 3];

Use bandwidths of and the standard deviation:

Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, {"Standardized", 1 / 2}]; π’Ÿ2 = SmoothKernelDistribution[data, {"Standardized", 1 / 8}];
Wolfram Language code: Table[Plot[PDF[π’Ÿ, x], {x, -4, 4}, Filling -> Axis, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

Allow the bandwidth to vary adaptively with local density:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10 ^ 3];

Vary the local sensitivity from 0 (none) to 1 (full):

Wolfram Language code: Table[Plot[Evaluate[PDF[SmoothKernelDistribution[data, {"Adaptive", Automatic, s}], x]], {x, -4, 4}, PlotLabel -> Row[{"s = ", s}]], {s, {0, .25, .75, 1}}]

Vary the initial bandwidth for an adaptive estimate:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10 ^ 3];

Specify an initial bandwidth of 1.0 and 0.1, respectively:

Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, {"Adaptive", 1.0, .5}]; π’Ÿ2 = SmoothKernelDistribution[data, {"Adaptive", 0.1, .5}];
Wolfram Language code: Table[Plot[PDF[π’Ÿ, x], {x, -4, 4}, Filling -> Axis, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

Use any of several automatic bandwidth selection methods:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 100];
Wolfram Language code: Table[Plot[Evaluate[PDF[SmoothKernelDistribution[data, name], x]], {x, -4, 4}, Filling -> Axis, Exclusions -> None, PlotLabel -> name], {name, {"LeastSquaresCrossValidation", "Oversmooth", "Scott", "SheatherJones", "StandardDeviation", "StandardGaussian"}}]

Silverman's method is used by default:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10 ^ 3];
Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, "Silverman"]; π’Ÿ2 = SmoothKernelDistribution[data, Automatic];

The PDFs are equivalent:

Wolfram Language code: Table[Plot[PDF[π’Ÿ, x], {x, -4, 4}, Filling -> Axis, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

By default, Silverman's method is used to independently select bandwidths in each dimension:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.75], 25];
Wolfram Language code: Table[Plot3D[Evaluate[PDF[SmoothKernelDistribution[data, name], {x, y}]], {x, -3, 3}, {y, -3, 3}, PlotRange -> All, PlotLabel -> name, Exclusions -> None], {name, {Automatic, "Silverman"}}]

Any automated method can be used to independently select diagonal bandwidth elements:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.75], 25];
Wolfram Language code: Table[Plot3D[Evaluate[PDF[SmoothKernelDistribution[data, name], {x, y}]], {x, -3, 3}, {y, -3, 3}, PlotRange -> All, PlotLabel -> name, Exclusions -> None], {name, {"LeastSquaresCrossValidation", "Oversmooth", "Scott", "SheatherJones", "StandardDeviation", "StandardGaussian"}}]

Methods used to estimate the bandwidth diagonal need not be the same:

Wolfram Language code: BlockRandom[SeedRandom[6];data = RandomVariate[NormalDistribution[], {10, 3}]];

Use adaptive, oversmoothed, and constant bandwidths in the respective dimensions:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, {{"Adaptive", .05, 1}, "Silverman", 2}];

Plot the univariate marginal PDFs:

Wolfram Language code: Table[Plot[Evaluate[PDF[MarginalDistribution[π’Ÿ, i], x]], {x, -4, 4}, PlotRange -> All, PlotLabel -> i], {i, {1, 2, 3}}]

Give a scalar value to use the same bandwidth in all dimensions:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.75], 25];
Wolfram Language code: bands = {.25, .5, 1.0};
Wolfram Language code: Table[Plot3D[Evaluate[PDF[SmoothKernelDistribution[data, bw], {x, y}]], {x, -3, 3}, {y, -3, 3}, PlotRange -> All, PlotLabel -> Row[{"bandwidth = ", bw * IdentityMatrix[2]}], Exclusions -> None], {bw, bands}]

To use nonzero off-diagonal elements, give a fully specified bandwidth matrix:

Wolfram Language code: bw = {{1 / 2, 1 / 4}, {1 / 4, 1 / 2}};
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[RandomVariate[NormalDistribution[], {100, 2}], bw];
Wolfram Language code: ContourPlot[Evaluate[PDF[π’Ÿ, {x, y}]], {x, -3, 3}, {y, -3, 3}, PlotRange -> All]

Kernel Functions  (6)

Specify any one of several kernel functions:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 100];
Wolfram Language code: Table[Plot[Evaluate[PDF[SmoothKernelDistribution[data, Automatic, i], x]], {x, -4, 4}, Filling -> Axis, Ticks -> None, PlotLabel -> i, Exclusions -> None], {i, {"Biweight", "Cosine", "Epanechnikov", "Gaussian", "Rectangular", "SemiCircle", "Triangular", "Triweight"}}]

Define the kernel function as a pure function:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10];
Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, Automatic]; π’Ÿ2 = SmoothKernelDistribution[data, Automatic, (1/Ο€ (1 + #1^2))&];
Wolfram Language code: Table[Plot[Evaluate[PDF[π’Ÿ, x]], {x, -4, 4}, Filling -> Axis, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

By default, the Gaussian kernel is used:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10];
Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, Automatic]; π’Ÿ2 = SmoothKernelDistribution[data, Automatic, "Gaussian"];
Wolfram Language code: Table[Plot[Evaluate[PDF[π’Ÿ, x]], {x, -4, 4}, Filling -> Axis, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

This is equivalent to using the PDF of a NormalDistribution[0,1]:

Wolfram Language code: π’Ÿ3 = SmoothKernelDistribution[data, Automatic, PDF[NormalDistribution[], #]&];
Wolfram Language code: Plot[PDF[π’Ÿ3, x], {x, -4, 4}, Filling -> Axis, Exclusions -> None]

Shapes of some univariate kernel functions:

Wolfram Language code: kernels = {"Biweight", "Cosine", "Epanechnikov", "Gaussian", "Rectangular", "SemiCircle", "Triangular", "Custom"};
Wolfram Language code: dists = Table[SmoothKernelDistribution[{0}, 1, i], {i, (kernels /. {"Custom" -> (PDF[CauchyDistribution[0, 1], #]&)})}];
Wolfram Language code: Table[Plot[Evaluate[PDF[dists[[i]], x]], {x, -3, 3}, PlotRange -> All, PlotLabel -> kernels[[i]], Filling -> Axis, Ticks -> None], {i, Length[kernels]}]

Specify any one of several kernel functions for multivariate data:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.75], 10];
Wolfram Language code: Table[Plot3D[Evaluate[PDF[SmoothKernelDistribution[data, Automatic, i], {x, y}]], {x, -4, 4}, {y, -4, 4}, Ticks -> None, PlotLabel -> i, PlotRange -> All, MeshFunctions -> (#3&)], {i, {"Biweight", "Cosine", "Epanechnikov", "Gaussian", "Rectangular", "SemiCircle", "Triangular", "Triweight"}}]

Choose between product- and radial-type kernel functions for multivariate data:

Wolfram Language code: data = {{0, 0}};
Wolfram Language code: kerns = {{"Product", "Biweight"}, {"Radial", "Biweight"}};
Wolfram Language code: Table[Plot3D[Evaluate[PDF[ SmoothKernelDistribution[data, 1, i], {x, y}]], {x, -1.5, 1.5}, {y, -1.5, 1.5}, Ticks -> None, PlotLabel -> i, PlotRange -> All, MeshFunctions -> (#3 &), Boxed -> False], {i, kerns}]

Estimation with Fixed Domain  (4)

Use bounding to stay within the domain:

Wolfram Language code: data = RandomVariate[BetaDistribution[2, 3], 10 ^ 4];

Define the smooth kernel distribution with a Gaussian kernel:

Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, Automatic, "Gaussian"];

The support for PDF extends beyond the data support:

Wolfram Language code: Plot[PDF[π’Ÿ1, x]//Evaluate, {x, -0.1, 1.1}]

Impose bounds:

Wolfram Language code: π’Ÿ2 = SmoothKernelDistribution[data, Automatic, {"Bounded", {0, 1}, "Gaussian"}];
Wolfram Language code: Plot[PDF[π’Ÿ2, x]//Evaluate, {x, -.1, 1.1}]

Compare to the original BetaDistribution:

Wolfram Language code: Plot[{PDF[π’Ÿ2, x], PDF[BetaDistribution[2, 3], x]}//Evaluate, {x, -.1, 1.1}, PlotLegends -> {"Bounded smooth kernel density estimate", "Beta distribution density"}]

Compare smooth kernel distributions with a bounded Epanechnikov kernel:

Wolfram Language code: sample = RandomReal[{-8, 8}, 512];
Wolfram Language code: skd[c_] := SmoothKernelDistribution[sample, .25, {"Bounded", {-c, c}, "Epanechnikov"}]
Wolfram Language code: Table[Plot[Evaluate[PDF[skd[c], x]], {x, -10, 10}, Filling -> Axis, PlotRange -> {0, .2}, PlotLabel -> {-c, c}], {c, {∞, 8}}]

The bounded smooth kernel density estimate is more accurate at the boundaries:

Wolfram Language code: QuantilePlot[{skd[Infinity], skd[8]}, UniformDistribution[{-8, 8}], PlotRange -> {{-8.5, -5}, {-8.5, -5}}, PlotLegends -> {"Unbounded", "Bounded to (-8,8)"}]

Use a bounded cosine kernel for two-dimensional data:

Wolfram Language code: cpd = CopulaDistribution[{"Binormal", .75}, {TriangularDistribution[{0, 1}], WignerSemicircleDistribution[1]}];
Wolfram Language code: data = RandomVariate[cpd, 10 ^ 4];
Wolfram Language code: skd = SmoothKernelDistribution[data, .2, {"Bounded", {{0, 1}, {-1, 1}}, "Cosine"}]

Compare the estimated density to the population distribution density:

Wolfram Language code: Table[Plot3D[pdf, {x, -0.5, 1.5}, {y, -1.5, 1.5}, PlotRange -> All, AxesLabel -> Automatic, ImageSize -> 220, PlotTheme -> "CoolColors", Exclusions -> {{(1 - y ^ 2), 0 < x < 1}, {x(1 - x) == 0, -1 < y < 1}}], {pdf, {PDF[skd, {x, y}], PDF[cpd, {x, y}]}}]

Bounded Gaussian kernel:

Wolfram Language code: data = RandomReal[{-3, 5}, 10 ^ 3];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, .5, {"Bounded", {-3, 5}, "Gaussian"}];

Truncating the ordinary smooth kernel distribution yields a different result:

Wolfram Language code: π’Ÿ2 = TruncatedDistribution[{-3, 5}, SmoothKernelDistribution[data, .5, "Gaussian"]];
Wolfram Language code: Plot[{PDF[π’Ÿ, x], PDF[π’Ÿ2, x]}//Evaluate, {x, -4, 6}, PlotLegends -> {"Bounded", "Truncated"}]

Options  (25)

InterpolationPoints  (6)

By default, nonuniform interpolation is used to create a smooth estimate:

Wolfram Language code: data = RandomVariate[𝒹 = CauchyDistribution[0, 1], 10 ^ 3];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, InterpolationPoints -> Automatic];
Wolfram Language code: Plot[{PDF[π’Ÿ, x], PDF[𝒹, x]}, {x, -10, 10}, PlotRange -> All, PlotLegends -> {"π’Ÿ", "𝒹"}]

Specify the initial number of sample points to use:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10];

Use 4 interpolation points:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, InterpolationPoints -> 4];
Wolfram Language code: Plot[PDF[π’Ÿ, x], {x, -6, 6}, Filling -> Axis, PlotRange -> All]

A larger number of points yields a smoother estimate:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10];
Wolfram Language code: estimates = Table[SmoothKernelDistribution[data, InterpolationPoints -> i, MaxRecursion -> 3], {i, {2, 4, 6, 8}}];
Wolfram Language code: Table[Plot[PDF[i, x], {x, -4, 4}, Filling -> Axis], {i, estimates}]

Specify the number of interpolating points to use for bivariate data:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.8], 100];

Use 5 and 50 interpolation points in each dimension:

Wolfram Language code: estimates = Table[SmoothKernelDistribution[data, InterpolationPoints -> i], {i, {5, 50}}];
Wolfram Language code: Table[ContourPlot[PDF[i, {x, y}]//Evaluate, {x, -3, 3}, {y, -3, 3}, PlotRange -> All], {i, estimates}]

Use different numbers of interpolation points in each dimension:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.8], 100];

Specify 3 and 30 points or 30 and 3:

Wolfram Language code: estimates = Table[SmoothKernelDistribution[data, InterpolationPoints -> i, MaxRecursion -> 3], {i, {{3, 30}, {30, 3}}}];
Wolfram Language code: Table[ContourPlot[PDF[i, {x, y}]//Evaluate, {x, -4, 4}, {y, -4, 4}, PlotRange -> All], {i, estimates}]

A smooth result does not imply a high-quality estimate:

Wolfram Language code: π’Ÿh = HistogramDistribution[RandomVariate[NormalDistribution[], 100], 5];

Using 1000 interpolation points creates a very smooth estimate in this case:

Wolfram Language code: π’Ÿs = SmoothKernelDistribution[RandomVariate[π’Ÿh, 100], InterpolationPoints -> 1000];
Wolfram Language code: Plot[{PDF[π’Ÿs, x], PDF[π’Ÿh, x]}, {x, -4, 4}, PlotRange -> All, Exclusions -> None, PlotLegends -> {"π’Ÿs", "π’Ÿh"}]

MaxExtraBandwidths  (6)

By default, the estimate extends at most 12 bandwidths beyond the data:

Wolfram Language code: data = RandomVariate[𝒹 = ParetoDistribution[1, 2], 10 ^ 3];
Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, MaxExtraBandwidths -> 12]; π’Ÿ2 = SmoothKernelDistribution[data, MaxExtraBandwidths -> Automatic];
Wolfram Language code: Table[Plot[PDF[π’Ÿ, x], {x, 0, 10}, PlotRange -> All], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

Set the maximum number of bandwidths to use:

Wolfram Language code: data = RandomVariate[𝒹 = ParetoDistribution[1, 2], 10 ^ 3];
Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, MaxExtraBandwidths -> 0]; π’Ÿ2 = SmoothKernelDistribution[data, MaxExtraBandwidths -> 12];

Use 0 and 12 bandwidths, respectively:

Wolfram Language code: Table[Plot[PDF[π’Ÿ, x], {x, 0, 10}, PlotRange -> All, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

Set a different number for each endpoint:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10];
Wolfram Language code: mebw = {{0, 0}, {0, 12}, {12, 0}, {12, 12}};
Wolfram Language code: π’Ÿ = Table[SmoothKernelDistribution[data, MaxExtraBandwidths -> i], {i, mebw}];
Wolfram Language code: Table[Plot[PDF[π’Ÿ[[i]], x], {x, -6, 6}, PlotRange -> All, Filling -> Axis, PlotLabel -> mebw[[i]], Ticks -> None], {i, 4}]

Specify the number of extra bandwidths to use for multivariate data:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.5], 10];
Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, MaxExtraBandwidths -> 0]; π’Ÿ2 = SmoothKernelDistribution[data, MaxExtraBandwidths -> 12];

Use 0 and 12 bandwidths, respectively:

Wolfram Language code: Table[ContourPlot[PDF[π’Ÿ, {x, y}], {x, -4, 4}, {y, -4, 4}, PlotRange -> All, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

Specify the number of extra bandwidths to use in each dimension:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.5], 10];
Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, MaxExtraBandwidths -> {0, 12}]; π’Ÿ2 = SmoothKernelDistribution[data, MaxExtraBandwidths -> {12, 0}];

Use 0 and 12 bandwidths or 12 and 0 bandwidths, respectively:

Wolfram Language code: Table[ContourPlot[PDF[π’Ÿ, {x, y}], {x, -4, 4}, {y, -4, 4}, PlotRange -> All, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

Set a different number for each endpoint in each dimension:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.5], 10];
Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, MaxExtraBandwidths -> {{0, 12}, {12, 0}}]; π’Ÿ2 = SmoothKernelDistribution[data, MaxExtraBandwidths -> {{12, 0}, {0, 12}}];
Wolfram Language code: Table[ContourPlot[PDF[π’Ÿ, {x, y}], {x, -4, 4}, {y, -4, 4}, PlotRange -> All, Exclusions -> None], {π’Ÿ, {π’Ÿ1, π’Ÿ2}}]

MaxMixtureKernels  (6)

By default, the number of kernels is generally optimal:

Wolfram Language code: data = RandomVariate[𝒹 = ParetoDistribution[1, 2], 10 ^ 4];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, MaxMixtureKernels -> Automatic];
Wolfram Language code: Plot[{PDF[π’Ÿ, x], PDF[𝒹, x]}, {x, 0, 6}, PlotRange -> {0, 1.3}, PlotLegends -> {"π’Ÿ", "𝒹"}]

Specify the maximum number of kernels to use in the estimate:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10];

Place at most 5 kernels:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, MaxMixtureKernels -> 5];
Wolfram Language code: Plot[PDF[π’Ÿ, x], {x, -4, 4}, Filling -> Axis, PlotRange -> All]

A larger number of kernels gives a better estimate of the underlying distribution:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10 ^ 4];
Wolfram Language code: estimates = Table[SmoothKernelDistribution[data, MaxMixtureKernels -> i], {i, {10, 15, 25, 100}}];
Wolfram Language code: Table[Plot[{PDF[i, x], PDF[NormalDistribution[], x]}, {x, -4, 4}, Filling -> Axis, PlotRange -> All], {i, estimates}]

Place a kernel at each data point:

Wolfram Language code: data = {-2, 0, 2};
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, .25, MaxMixtureKernels -> All];
Wolfram Language code: Plot[PDF[π’Ÿ, x], {x, -4, 4}, Filling -> Axis]

Vary the bandwidth used for the same number of kernels:

Wolfram Language code: Table[Plot[PDF[SmoothKernelDistribution[data, bw, MaxMixtureKernels -> All], x]//Evaluate, {x, -4, 4}, Filling -> Axis, PlotRange -> {0, .6}, PlotLabel -> Row[{"bandwidth = ", bw}]], {bw, {0.25, 0.5, 0.75, 1.0}}]

Specify the maximum number of kernels to use in each dimension for bivariate data:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.8], 100];

Place at most 10 and 100 kernels, respectively:

Wolfram Language code: estimates = Table[SmoothKernelDistribution[data, .2, MaxMixtureKernels -> i], {i, {10, 100}}];
Wolfram Language code: Table[DensityPlot[PDF[i, {x, y}]//Evaluate, {x, -4, 4}, {y, -4, 4}, PlotPoints -> 100, PlotRange -> All, ColorFunction -> "TemperatureMap"], {i, estimates}]

Set the maximum number of kernels in each dimension:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.8], 100];

Specify a maximum of 5 and 50 kernels or 50 and 5:

Wolfram Language code: estimates = Table[SmoothKernelDistribution[data, MaxMixtureKernels -> i], {i, {{5, 50}, {50, 5}}}];
Wolfram Language code: Table[Plot3D[Evaluate[PDF[i, {x, y}]], {x, -4, 4}, {y, -4, 4}, PlotPoints -> 50, PlotRange -> All], {i, estimates}]

MaxRecursion  (4)

A smooth estimate will usually be returned by default:

Wolfram Language code: data = RandomVariate[𝒹 = NormalDistribution[], 10 ^ 3];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, MaxRecursion -> Automatic];
Wolfram Language code: Plot[{PDF[π’Ÿ, x], PDF[𝒹, x]}, {x, -5, 5}, PlotLegends -> {"π’Ÿ", "𝒹"}]

Specify the maximum number of recursive subdivisions to use:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10];
Wolfram Language code: π’Ÿ = Table[SmoothKernelDistribution[data, InterpolationPoints -> 3, MaxRecursion -> i], {i, {0, 2, 4, 6}}];
Wolfram Language code: Table[Plot[PDF[i, x], {x, -5, 5}, Filling -> Axis, PlotRange -> All], {i, π’Ÿ}]

Give the maximum number of recursive subdivisions for bivariate data:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.8], 100];

Use at most 2 and 6 subdivisions, respectively:

Wolfram Language code: estimates = Table[SmoothKernelDistribution[data, MaxRecursion -> i, InterpolationPoints -> 3], {i, {2, 6}}];
Wolfram Language code: Table[Plot3D[PDF[i, {x, y}]//Evaluate, {x, -4, 4}, {y, -4, 4}, PlotRange -> All, ColorFunction -> "TemperatureMap"], {i, estimates}]

Set the maximum number of recursive subdivisions in each dimension:

Wolfram Language code: data = RandomVariate[BinormalDistribution[.8], 100];

Specify a maximum of 0 and 3 subdivisions or 3 and 0:

Wolfram Language code: estimates = Table[SmoothKernelDistribution[data, MaxRecursion -> i, InterpolationPoints -> 6], {i, {{0, 3}, {3, 0}}}];
Wolfram Language code: Table[Plot3D[PDF[i, {x, y}]//Evaluate, {x, -4, 4}, {y, -4, 4}, PlotRange -> All], {i, estimates}]

PerformanceGoal  (3)

By default, estimates are optimized for a balance between speed and quality:

Wolfram Language code: data = RandomVariate[𝒹 = NormalDistribution[], 10 ^ 5];
Wolfram Language code: (π’Ÿ = SmoothKernelDistribution[data, PerformanceGoal -> Automatic])//Timing
Wolfram Language code: Plot[{PDF[π’Ÿ, x], PDF[𝒹, x]}, {x, -5, 5}, PlotLegends -> {"π’Ÿ", "𝒹"}]

Set PerformanceGoal for speed or quality or use Automatic to balance the two:

Wolfram Language code: data = RandomVariate[𝒹 = MixtureDistribution[{1, 1}, {MultinormalDistribution[{-1, -1}, IdentityMatrix[2]], MultinormalDistribution[{1, 1}, .5IdentityMatrix[2]]}], 10 ^ 2];

More time is spent with PerformanceGoal set to "Quality":

Wolfram Language code: π’Ÿ1 = SmoothKernelDistribution[data, PerformanceGoal -> "Speed"];//Timing
Wolfram Language code: π’Ÿ2 = SmoothKernelDistribution[data, PerformanceGoal -> Automatic];//Timing
Wolfram Language code: π’Ÿ3 = SmoothKernelDistribution[data, PerformanceGoal -> "Quality"];//Timing
Wolfram Language code: Table[ContourPlot[Evaluate[PDF[π’Ÿ, {x, y}]], {x, -4, 4}, {y, -4, 4}, PlotPoints -> 35, PlotRange -> All], {π’Ÿ, {π’Ÿ1, π’Ÿ2, π’Ÿ3}}]

Use with ControlActive to vary PerformanceGoal dynamically:

Wolfram Language code: data = RandomVariate[MixtureDistribution[{1 / 2, 1 / 10, 1 / 10, 1 / 10, 1 / 10, 1 / 10}, Join[{NormalDistribution[]}, Table[NormalDistribution[i / 2 - 1, 1 / 10], {i, 0, 4}]]], 3 * 10 ^ 3];
Wolfram Language code: Manipulate[Plot[PDF[SmoothKernelDistribution[data, PerformanceGoal -> ControlActive["Speed", "Quality"]], x]//Evaluate, {x, a, b}, PlotRange -> {Automatic, {0, .55}}], {a, -3, 0.1}, {b, 3, 0, -.1}, SaveDefinitions -> True]

Applications  (14)

Compare an estimated density to a theoretical model:

Wolfram Language code: 𝒹 = MixtureDistribution[{1 / 2, 1 / 10, 1 / 10, 1 / 10, 1 / 10, 1 / 10}, Join[{NormalDistribution[]}, Table[NormalDistribution[i / 2 - 1, 1 / 10], {i, 0, 4}]]];
Wolfram Language code: data = RandomVariate[𝒹, 10 ^ 5];

Use adaptive bandwidths for highly oscillatory densities:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, {"Adaptive", Automatic, .25}, PerformanceGoal -> "Quality"];
Wolfram Language code: Plot[{PDF[π’Ÿ, x], PDF[𝒹, x]}, {x, -4, 4}, PlotLegends -> {"π’Ÿ", "𝒹"}]

The moments of the model and the estimate are similar:

Wolfram Language code: {Mean[𝒹], Variance[𝒹], Skewness[𝒹], Kurtosis[𝒹]}//N
Wolfram Language code: {Mean[π’Ÿ], Variance[π’Ÿ], Skewness[π’Ÿ], Kurtosis[π’Ÿ]}

Use TruncatedDistribution to restrict the domain after smoothing:

Wolfram Language code: data = RandomVariate[ExponentialDistribution[2], 10 ^ 4];
Wolfram Language code: dist = SmoothKernelDistribution[data];
Wolfram Language code: π’Ÿ = TruncatedDistribution[{0, Infinity}, dist];

The estimate is restricted to positive values:

Wolfram Language code: Plot[PDF[π’Ÿ, x]//Evaluate, {x, -1, 5}, PlotRange -> All, Filling -> Axis]

Verify that the distribution is bound by the truncation region:

Wolfram Language code: NProbability[x < 0, xο’π’Ÿ]

Use with Cases to restrict the data domain before smoothing:

Wolfram Language code: data = Cases[RandomVariate[NormalDistribution[], 10 ^ 5], x_ /; x > 0];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data];

The estimate goes beyond the data on the left, but the data is restricted to positive values:

Wolfram Language code: Plot[PDF[π’Ÿ, x], {x, -1, 5}, PlotRange -> All, Filling -> Axis]

The probability that the data falls below zero is not zero:

Wolfram Language code: NProbability[x < 0, xο’π’Ÿ]

Use MaxExtraBandwidths to restrict the domain without dropping data:

Wolfram Language code: data = RandomVariate[ExponentialDistribution[2], 10 ^ 6];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, MaxExtraBandwidths -> {0, 12}];

The estimate stops at the minimum data value, which is restricted to positive values:

Wolfram Language code: Plot[PDF[π’Ÿ, x], {x, -3, 3}, PlotRange -> All, Filling -> Axis]
Wolfram Language code: NProbability[x < 0, xο’π’Ÿ]

Estimate the distribution of the lengths of human chromosomes:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[ N[Log[Table[GenomeData[i, "SequenceLength"], {i, 41}] ]]];
Wolfram Language code: Plot[PDF[π’Ÿ, x], {x, 0, 30}, Filling -> Axis, Frame -> True]

The expected chromosome length, given that the length is greater than the mean:

Wolfram Language code: NExpectation[xx > Mean[π’Ÿ], xο’π’Ÿ]

Smooth the discrete distribution of the differences of successive primes:

Wolfram Language code: data = Table[Prime[i] - Prime[i - 1], {i, 2, 10 ^ 4}];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data];
Wolfram Language code: Plot[PDF[π’Ÿ, x], {x, -10, 50}, Filling -> Axis, Frame -> True, PlotRange -> All, Axes -> False]
Wolfram Language code: NExpectation[13 + x, xο’π’Ÿ]

Investigate the distribution of differenced daily returns on the S&P 500 during the 1990s:

Wolfram Language code: sp500 = ExampleData[{"Statistics", "SP500"}];
Wolfram Language code: Subscript[π’Ÿ, SP500] = SmoothKernelDistribution[sp500, {"Adaptive", Automatic, .25}];

Compare the smoothed distribution to a fitted model:

Wolfram Language code: dfit = EstimatedDistribution[sp500, LaplaceDistribution[ΞΌ, Ξ²]];
Wolfram Language code: Plot[{PDF[dfit, x], PDF[Subscript[π’Ÿ, SP500], x]}, {x, -5, 5}, PlotRange -> All, AxesOrigin -> {-5, 0}, PlotLegends -> {"dfit", "οŸοŸ‰οŸˆSubscriptBox[οŸ‰π’ŸοŸ€, οŸ‰SP500οŸ€]οŸ€"}]

Compare the distribution of salaries from two university departments:

Wolfram Language code: ExampleData[{"Statistics", "UniversitySalaries"}, "ColumnDescriptions"]
Wolfram Language code: fullData = ExampleData[{"Statistics", "UniversitySalaries"}][[All, {1, 3}]];

Select salaries for two departments and attach currency units:

Wolfram Language code: statSalaries = Cases[fullData, {"Statistics", salary_} :> salary]; chemSalaries = Cases[fullData, {"Chemistry", salary_} :> salary];
Wolfram Language code: Subscript[π’Ÿ, Stat] = SmoothKernelDistribution[QuantityArray[statSalaries, "USDollars"]]; Subscript[π’Ÿ, Chem] = SmoothKernelDistribution[QuantityArray[chemSalaries, "USDollars"]];
Wolfram Language code: Table[Plot[PDF[π’Ÿ, Quantity[x, "USDollars"]], {x, 0, 250000}, Ticks -> {{{70000, "70K"}, {125000, "125K"}, {200000, "200K"}}, None}, PlotRange -> All, Filling -> Axis, AxesLabel -> {"$"}], {π’Ÿ, {Subscript[π’Ÿ, Stat], Subscript[π’Ÿ, Chem]}}]

Estimate the joint distribution of Old Faithful eruption durations and waiting times:

Wolfram Language code: oldF = QuantityArray[ExampleData[{"Statistics", "OldFaithful"}], "Minutes"];
Wolfram Language code: Subscript[π’Ÿ, OldF] = SmoothKernelDistribution[oldF, "SheatherJones"];
Wolfram Language code: Plot3D[PDF[Subscript[π’Ÿ, OldF], Quantity[{x, y}, "Minutes"]]//Evaluate, {x, 1, 6}, {y, 35, 105}, PlotRange -> All, Exclusions -> None, AspectRatio -> 1, PlotPoints -> 50, AxesLabel -> {"Duration", "Waiting", None}]

Probability an eruption lasts more than two minutes and the waiting time is less than one hour:

Wolfram Language code: NProbability[x > Quantity[2, "Minutes"] && y < Quantity[60, "Minutes"], {x, y}Subscript[π’Ÿ, OldF], PrecisionGoal -> 3]

Smooth a histogram:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10 ^ 4];
Wolfram Language code: hist = HistogramDistribution[data];

Generate random numbers from the histogram for smoothing:

Wolfram Language code: samples = RandomVariate[hist, 10 ^ 5];
Wolfram Language code: {DiscretePlot[PDF[hist, x], {x, -4, 4, .05}], Plot[PDF[SmoothKernelDistribution[samples, "Oversmooth"], x]//Evaluate, {x, -4, 4}, Filling -> Axis]}

Smooth an estimate returned from SurvivalDistribution:

Wolfram Language code: data = RandomInteger[{10, 40}, 50];
Wolfram Language code: censoring = RandomInteger[{0, 1}, 50];
Wolfram Language code: π’Ÿ = SurvivalDistribution[EventData[data, censoring]];
Wolfram Language code: samples = RandomVariate[π’Ÿ, 10 ^ 4];
Wolfram Language code: Show[DiscretePlot[SurvivalFunction[π’Ÿ, x], {x, data}], Plot[SurvivalFunction[𝒹 = SmoothKernelDistribution[samples], x]//Evaluate, {x, 0, 50}, PlotStyle -> RGBColor[0.87058837853668, 0.6048248459110492, 0.4922838688297661], PlotRange -> All], PlotRange -> {{5, 45}, All}, Axes -> False, Frame -> True]

Compute the probability of survival beyond 25, given that the survival time is greater than 10:

Wolfram Language code: NProbability[x > 25x > 10, x𝒹]

Create a confidence band for the PDF of snowfall accumulations in Buffalo, New York:

Wolfram Language code: ExampleData[{"Statistics", "BuffaloSnow"}, "Description"]
Wolfram Language code: data = QuantityArray[ExampleData[{"Statistics", "BuffaloSnow"}]//N, "Inches"];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data];
Wolfram Language code: bSamp = RandomChoice[Normal[data], {250, Length[data]}];

Smooth over each bootstrapped sample and obtain the confidence estimates:

Wolfram Language code: Subscript[π’Ÿ, B] = SmoothKernelDistribution[#]& /@ bSamp;
Wolfram Language code: rng = Range[10., 150]; pdf = Table[PDF[i, Quantity[rng, "Inches"]], {i, Subscript[π’Ÿ, B]}]; High = Table[Quantile[i, .975], {i, Transpose[pdf]}]; Low = Table[Quantile[i, .025], {i, Transpose[pdf]}];

Visualize the estimate of the PDF with the 95% confidence band:

Wolfram Language code: Show[Plot[PDF[π’Ÿ, Quantity[x, "Inches"]], {x, 0, 150}, PlotRange -> All, AxesLabel -> {"in"}], ListLinePlot[{Transpose[{rng, High}], Transpose[{rng, Low}]}, PlotStyle -> {{Dashed, Gray}}, Filling -> {1 -> {2}}]]

Confirm that the Mahalanobis distance has an asymptotic ChiSquareDistribution[p], given p-dimensional multivariate normal data:

Wolfram Language code: data = Table[RandomVariate[MultinormalDistribution[ConstantArray[0, i], IdentityMatrix[i]], 10^3], {i, rng = Range[2, 5]}];
Wolfram Language code: MahalanobisDistance[data_] := Block[{m = Mean[data], cov = Inverse[Covariance[data]], temp}, temp = (#1 - m&) /@ data;Diagonal[temp.cov.Transpose[temp]]]
Wolfram Language code: π’Ÿs = Table[SmoothKernelDistribution[MahalanobisDistance[i]], {i, data}];
Wolfram Language code: Table[Plot[{PDF[ChiSquareDistribution[rng[[i]]], x], PDF[π’Ÿs[[i]], x]}, {x, 0, 30}, PlotRange -> All, PlotLabel -> Row[{"Dimension: ", rng[[i]]}]], {i, Length[rng]}]

The probability that the Mahalanobis distance will exceed 10, given four-dimensional normal data:

Wolfram Language code: NProbability[x > 10, xο’π’Ÿs[[3]]]

Estimate a heavy-tailed density using parametric tail models:

Wolfram Language code: data = BlockRandom[SeedRandom[11];RandomVariate[𝒹 = CauchyDistribution[0, .1], 10 ^ 3]];

The body is estimated well, but the tails are undersmoothed due to lack of data:

Wolfram Language code: Show[SmoothHistogram[data, PlotRange -> All], Plot[PDF[𝒹, x], {x, -10, 10}, PlotStyle -> {Dashed, RGBColor[0.87058837853668, 0.6048248459110492, 0.4922838688297661]}, PlotRange -> All], PlotRange -> {{-10, 10}, {0, .2}}]

Create a mixture of the kernel density estimate and estimated tail models:

Wolfram Language code: q10 = Quantile[data, .1];q90 = Quantile[data, .9];
Wolfram Language code: left = EstimatedDistribution[Select[data, # < q10&], TruncatedDistribution[{-∞, q10}, CauchyDistribution[a, b]]];
Wolfram Language code: right = EstimatedDistribution[Select[data, # > q90&], TruncatedDistribution[{q90, ∞}, CauchyDistribution[a, b]]];
Wolfram Language code: body = TruncatedDistribution[{q10, q90}, SmoothKernelDistribution[Select[data, q10 - 1 ≀ # ≀ q90 + 1&]]];
Wolfram Language code: π’Ÿ = MixtureDistribution[{.1, .8, .1}, {left, body, right}];

The entire estimate is smooth:

Wolfram Language code: Plot[{PDF[π’Ÿ, x], PDF[𝒹, x]}, {x, -20, 20}, PlotStyle -> {Automatic, {Dashed, RGBColor[0.87058837853668, 0.6048248459110492, 0.4922838688297661]}}, Exclusions -> None, PlotRange -> {0, .2}, PlotLegends -> {"π’Ÿ", "𝒹"}]

Properties & Relations  (8)

The resulting density estimate integrates to unity:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 100];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data];
Wolfram Language code: Integrate[PDF[π’Ÿ, x], {x, -Infinity, Infinity}]

By default, machine estimates are used:

Wolfram Language code: data = Range[10];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, 1];
Wolfram Language code: Precision[π’Ÿ]

Use high-precision data to get high-precision estimates:

Wolfram Language code: data = N[Range[10], 100];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, 1];
Wolfram Language code: Precision[π’Ÿ]

The PDF is piecewise linear:

Wolfram Language code: π’Ÿ = SmoothKernelDistribution[RandomVariate[NormalDistribution[], 100], InterpolationPoints -> 20, MaxRecursion -> 0];
Wolfram Language code: Plot[PDF[π’Ÿ, x], {x, -4, 4}]

The CDF and SurvivalFunction are piecewise quadratic:

Wolfram Language code: {Plot[CDF[π’Ÿ, x], {x, -4, 4}], Plot[SurvivalFunction[π’Ÿ, x], {x, -4, 4}]}

The HazardFunction is piecewise rational with linear over quadratic:

Wolfram Language code: Plot[HazardFunction[π’Ÿ, x], {x, -4, 4}]

SmoothKernelDistribution is a consistent estimator of the underlying distribution:

Wolfram Language code: data = Table[RandomVariate[NormalDistribution[], 10^i], {i, Range[4]}];
Wolfram Language code: π’Ÿl = Table[SmoothKernelDistribution[i], {i, data}];
Wolfram Language code: Table[Plot[{PDF[π’Ÿl[[i]], x], PDF[NormalDistribution[], x]}, {x, -5, 5}, PlotRange -> All, Exclusions -> None, PlotLabel -> Row[{"n=", Superscript[10, i]}]], {i, Range[4]}]

As the bandwidth approaches infinity, the estimate approaches the shape of the kernel:

Wolfram Language code: data = {-.5, 0, .5};
Wolfram Language code: 𝒦 = {"Gaussian", "Epanechnikov", "Biweight", "Triweight", "Rectangular", "Triangular", "Cosine", "SemiCircle"};
Wolfram Language code: Table[Plot[PDF[SmoothKernelDistribution[data, 200, i], x]//Evaluate, {x, -500, 500}, PlotRange -> All, Ticks -> None, AxesOrigin -> {0, 0}, PlotLabel -> i], {i, 𝒦}]

SmoothKernelDistribution is a linear interpolation of KernelMixtureDistribution:

Wolfram Language code: data = {-1.5, -1.0, -.2, -.1, 0., 1.5};
Wolfram Language code: pts = Table[{i, PDF[KernelMixtureDistribution[data], i]}, {i, Range[-4, 4, .1]}];
Wolfram Language code: {ListLinePlot[pts], Plot[PDF[SmoothKernelDistribution[data], x]//Evaluate, {x, -4, 4}]}

SmoothKernelDistribution works on the values only when the input is a TimeSeries or an EventSeries:

Wolfram Language code: ts = TemporalData[TimeSeries, {{{1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1}}, {{0, 99, 1}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.1];
Wolfram Language code: SmoothKernelDistribution[ts]

The same as:

Wolfram Language code: SmoothKernelDistribution[ts["Values"]]
Wolfram Language code: % == %%

SmoothKernelDistribution works with all the values together when the input is a TemporalData:

Wolfram Language code: td = TemporalData[Β«4Β»];
Wolfram Language code: SmoothKernelDistribution[td]

The same as:

Wolfram Language code: SmoothKernelDistribution[td["ValueList"]//Flatten]
Wolfram Language code: %% == %

Possible Issues  (4)

The kernel function needs to be a PDF:

Wolfram Language code: data = {-1.5, -1.0, -.2, -.1, 0., 1.5};
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, 1, Cos[#]&];

The resulting density estimate is not a PDF:

Wolfram Language code: Plot[PDF[π’Ÿ, x], {x, -4, 4}, Filling -> Axis]

Automatic adaptive bandwidths may be too small with large samples:

Wolfram Language code: data = RandomVariate[NormalDistribution[], 10 ^ 6];
Wolfram Language code: dist = SmoothKernelDistribution[data, {"Adaptive", Automatic, 1}];
Wolfram Language code: Plot[PDF[dist, x]//Evaluate, {x, -4, 4}, PlotRange -> All]

Try increasing the initial bandwidth, MaxMixtureKernels, or decreasing the sensitivity:

Wolfram Language code: dist2 = SmoothKernelDistribution[data, {"Adaptive", 1.5, 1}];
Wolfram Language code: Plot[PDF[dist2, x]//Evaluate, {x, -4, 4}, PlotRange -> All]

SmoothKernelDistribution does not know the domain of the underlying distribution:

Wolfram Language code: data = RandomVariate[𝒹 = BinomialDistribution[30, .5], 10 ^ 4];

The estimated PDF is continuous, although the underlying distribution is discrete:

Wolfram Language code: {DiscretePlot[PDF[𝒹, x], {x, 5, 25}], Plot[PDF[SmoothKernelDistribution[data], x]//Evaluate, {x, 5, 25}]}
Wolfram Language code: data2 = RandomVariate[𝒹2 = TruncatedDistribution[{-1, 1}, NormalDistribution[]], 10 ^ 4];

The estimated PDF is not bound on :

Wolfram Language code: {Plot[PDF[𝒹2, x], {x, -2, 2}, Exclusions -> None], Plot[PDF[SmoothKernelDistribution[data2], x]//Evaluate, {x, -2, 2}]}

With heavily adaptive bandwidths, these issues may be less obvious:

Wolfram Language code: data3 = RandomVariate[𝒹, 10 ^ 4]; data4 = RandomVariate[𝒹2, 10 ^ 4];
Wolfram Language code: {Plot[PDF[SmoothKernelDistribution[data3, {"Adaptive", Automatic, 1}], x]//Evaluate, {x, 5, 25}, PlotRange -> All], Plot[PDF[SmoothKernelDistribution[data4, {"Adaptive", Automatic, 1}], x]//Evaluate, {x, -2, 2}]}

The tails of some distributions are too heavy to interpolate effectively:

Wolfram Language code: SeedRandom[1];data = RandomVariate[𝒹 = StableDistribution[0, 1 / 9, 1 / 15, 1 / 15, 1], 10 ^ 3];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data, 10 ^ -5];
Wolfram Language code: {Plot[PDF[𝒹, x], {x, .054, .056}, PlotRange -> All], Plot[PDF[π’Ÿ, x], {x, .054, .056}, PlotRange -> All, Exclusions -> None]}

KernelMixtureDistribution uses symbolic methods that do not rely on interpolation:

Wolfram Language code: π’Ÿ = KernelMixtureDistribution[data, 10 ^ -5, MaxMixtureKernels -> All]//Quiet;
Wolfram Language code: {Plot[PDF[𝒹, x], {x, .054, .056}, PlotRange -> All], Plot[PDF[π’Ÿ, x], {x, .054, .056}, PlotRange -> All, Exclusions -> None]}

Neat Examples  (2)

Compute the distribution of temperature readings near your location:

Wolfram Language code: data = WeatherData[loc = FindGeoLocation[], "Temperature", {{2001, 1, 1}, {2009, 1, 1}}, "NonMetricValue"];
Wolfram Language code: data = Extract[data, Position[data, x_ /; NumericQ[x]]];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[data]
Wolfram Language code: Show[Plot[PDF[π’Ÿ, x], {x, -10, 110}, Frame -> True, Filling -> Axis, PlotLabel -> Row[{"Temperature Distribution: Lat ", Latitude[loc], " Lon ", Longitude[loc]}], FrameLabel -> {"Β°F", "Density"}, Axes -> False, PlotRange -> All, ColorFunction -> Function[{x, y}, ColorData["TemperatureMap"][x]]], Plot[PDF[π’Ÿ, x], {x, -10, 110}, PlotStyle -> StandardGray]]

Estimate the density of volcanic craters in western Uganda:

Wolfram Language code: dat = ExampleData[{"Statistics", "UgandaVolcanoes"}]; poly = ExampleData[{"Statistics", "WesternUgandaBorder"}];
Wolfram Language code: π’Ÿ = SmoothKernelDistribution[dat, "SheatherJones"];

A region function for a bounding polygon using winding numbers:

Wolfram Language code: inPolyQ = Compile[{{poly, _Real, 2}, {x, _Real}, {y, _Real}}, Block[{Xi, Yi, Xip1, Yip1, u, v, w}, {Xi, Yi} = Transpose[poly]; Xip1 = RotateLeft[Xi]; Yip1 = RotateLeft[Yi]; u = UnitStep[y - Yi]; v = RotateLeft[u]; w = UnitStep[-((Xip1 - Xi) (y - Yi) - (x - Xi) (Yip1 - Yi))]; Total[(u (1 - v) (1 - w) - (1 - u) v w)] β‰  0]];;
Wolfram Language code: dens = ContourPlot[PDF[π’Ÿ, {x, y}]//Evaluate, {x, 0, 3000}, {y, 550, 4500}, PlotRange -> All, PlotPoints -> 50, Contours -> 15, ColorFunction -> "SolarColors", RegionFunction -> (inPolyQ[poly, #1, #2]&)];
Wolfram Language code: Show[dens, ListLinePlot[poly, PlotStyle -> Thick], ListPlot[dat, PlotMarkers -> {Automatic, 5}, PlotStyle -> Black], PlotLabel -> Text[Style["Volcanic Crater Density", {Bold, 18}]]]

See Also

KernelMixtureDistribution  HistogramDistribution  EmpiricalDistribution  SurvivalDistribution  EstimatedDistribution  FindDistribution

Related Guides

    β–ͺ
  • Probability & Statistics with Quantities
  • β–ͺ
  • Nonparametric Statistical Distributions
  • β–ͺ
  • Probability & Statistics
  • β–ͺ
  • Random Variables
  • β–ͺ
  • Tabular Modeling
  • β–ͺ
  • Unsupervised Machine Learning
  • β–ͺ
  • Survival Analysis

History

Introduced in 2010 (8.0) | Updated in 2014 (10.0) β–ͺ 2016 (10.4)

Wolfram Research (2010), SmoothKernelDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/SmoothKernelDistribution.html (updated 2016).

Text

Wolfram Research (2010), SmoothKernelDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/SmoothKernelDistribution.html (updated 2016).

CMS

Wolfram Language. 2010. "SmoothKernelDistribution." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/SmoothKernelDistribution.html.

APA

Wolfram Language. (2010). SmoothKernelDistribution. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SmoothKernelDistribution.html

BibTeX

@misc{reference.wolfram_2026_smoothkerneldistribution, author="Wolfram Research", title="{SmoothKernelDistribution}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/SmoothKernelDistribution.html}", note=[Accessed: 01-September-2026]}

BibLaTeX

@online{reference.wolfram_2026_smoothkerneldistribution, organization={Wolfram Research}, title={SmoothKernelDistribution}, year={2016}, url={https://reference.wolfram.com/language/ref/SmoothKernelDistribution.html}, note=[Accessed: 01-September-2026]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • AI Access
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
Β© 2026 Wolfram
Β© 2026 Wolfram | Legal & Privacy Policy |
English