smile.stat.distribution
Class KernelDensity
- java.lang.Object
-
- smile.stat.distribution.KernelDensity
-
- All Implemented Interfaces:
- Distribution
public class KernelDensity extends java.lang.Object implements Distribution
Kernel density estimation is a non-parametric way of estimating the probability density function of a random variable. Kernel density estimation is a fundamental data smoothing problem where inferences about the population are made, based on a finite data sample. It is also known as the Parzen window method.
-
-
Constructor Summary
Constructors Constructor and Description KernelDensity(double[] x)Constructor.KernelDensity(double[] x, double h)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublebandwidth()Returns the bandwidth of kernel.doublecdf(double x)Cumulative distribution function.doubleentropy()Shannon entropy.doublelikelihood(double[] x)The likelihood of the samples.doublelogLikelihood(double[] x)The log likelihood of the samples.doublelogp(double x)The density at x in log scale, which may prevents the underflow problem.doublemean()The mean of distribution.intnpara()The number of parameters of the distribution.doublep(double x)The probability density function for continuous distribution or probability mass function for discrete distribution at x.doublequantile(double p)Inverse of CDF.doublerand()Random number generator.doublesd()The standard deviation of distribution.doublevar()The variance of distribution.
-
-
-
Constructor Detail
-
KernelDensity
public KernelDensity(double[] x)
Constructor. The bandwidth of kernel will be estimated by the rule of thumb.- Parameters:
x- the samples to estimate the density function.
-
KernelDensity
public KernelDensity(double[] x, double h)Constructor.- Parameters:
x- the samples to estimate the density function.h- a bandwidth parameter for smoothing.
-
-
Method Detail
-
bandwidth
public double bandwidth()
Returns the bandwidth of kernel.- Returns:
- the bandwidth of kernel
-
npara
public int npara()
Description copied from interface:DistributionThe number of parameters of the distribution.- Specified by:
nparain interfaceDistribution
-
mean
public double mean()
Description copied from interface:DistributionThe mean of distribution.- Specified by:
meanin interfaceDistribution
-
var
public double var()
Description copied from interface:DistributionThe variance of distribution.- Specified by:
varin interfaceDistribution
-
sd
public double sd()
Description copied from interface:DistributionThe standard deviation of distribution.- Specified by:
sdin interfaceDistribution
-
entropy
public double entropy()
Shannon entropy. Not supported.- Specified by:
entropyin interfaceDistribution
-
rand
public double rand()
Random number generator. Not supported.- Specified by:
randin interfaceDistribution
-
p
public double p(double x)
Description copied from interface:DistributionThe probability density function for continuous distribution or probability mass function for discrete distribution at x.- Specified by:
pin interfaceDistribution
-
logp
public double logp(double x)
Description copied from interface:DistributionThe density at x in log scale, which may prevents the underflow problem.- Specified by:
logpin interfaceDistribution
-
cdf
public double cdf(double x)
Cumulative distribution function. Not supported.- Specified by:
cdfin interfaceDistribution
-
quantile
public double quantile(double p)
Inverse of CDF. Not supported.- Specified by:
quantilein interfaceDistribution
-
likelihood
public double likelihood(double[] x)
The likelihood of the samples. Not supported.- Specified by:
likelihoodin interfaceDistribution
-
logLikelihood
public double logLikelihood(double[] x)
The log likelihood of the samples. Not supported.- Specified by:
logLikelihoodin interfaceDistribution
-
-
DataMelt 3.0 © DataMelt by jWork.ORG