smile.stat.distribution
Class ShiftedGeometricDistribution
- java.lang.Object
-
- smile.stat.distribution.AbstractDistribution
-
- smile.stat.distribution.DiscreteDistribution
-
- smile.stat.distribution.ShiftedGeometricDistribution
-
- All Implemented Interfaces:
- DiscreteExponentialFamily, Distribution
public class ShiftedGeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily
The "shifted" geometric distribution is a discrete probability distribution of the number of failures before the first success, supported on the set {0, 1, 2, 3, …}. If the probability of success on each trial is p, then the probability that the k-th trial (out of k trials) is the first success is Pr(X = k) = (1 - p)k p.- See Also:
GeometricDistribution
-
-
Constructor Summary
Constructors Constructor and Description ShiftedGeometricDistribution(double p)Constructor.ShiftedGeometricDistribution(int[] data)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecdf(double k)Cumulative distribution function.doubleentropy()Shannon entropy of the distribution.doublegetProb()Returns the probability of success.doublelogp(int k)The probability mass function in log scale.DiscreteMixture.ComponentM(int[] x, double[] posteriori)The M step in the EM algorithm, which depends the specific distribution.doublemean()The mean of distribution.intnpara()The number of parameters of the distribution.doublep(int k)The probability mass function.doublequantile(double p)The quantile, the probability to the left of quantile is p.doublerand()Generates a random number following this distribution.doublesd()The standard deviation of distribution.java.lang.StringtoString()doublevar()The variance of distribution.-
Methods inherited from class smile.stat.distribution.DiscreteDistribution
likelihood, logLikelihood, logp, p
-
Methods inherited from class smile.stat.distribution.AbstractDistribution
likelihood, logLikelihood
-
-
-
-
Constructor Detail
-
ShiftedGeometricDistribution
public ShiftedGeometricDistribution(double p)
Constructor.- Parameters:
p- the probability of success.
-
ShiftedGeometricDistribution
public ShiftedGeometricDistribution(int[] data)
Constructor. Parameter will be estimated from the data by MLE.
-
-
Method Detail
-
getProb
public double getProb()
Returns the probability of success.
-
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()
Description copied from interface:DistributionShannon entropy of the distribution.- Specified by:
entropyin interfaceDistribution
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
rand
public double rand()
Description copied from interface:DistributionGenerates a random number following this distribution.- Specified by:
randin interfaceDistribution
-
p
public double p(int k)
Description copied from class:DiscreteDistributionThe probability mass function.- Specified by:
pin classDiscreteDistribution
-
logp
public double logp(int k)
Description copied from class:DiscreteDistributionThe probability mass function in log scale.- Specified by:
logpin classDiscreteDistribution
-
cdf
public double cdf(double k)
Description copied from interface:DistributionCumulative distribution function. That is the probability to the left of x.- Specified by:
cdfin interfaceDistribution
-
quantile
public double quantile(double p)
Description copied from interface:DistributionThe quantile, the probability to the left of quantile is p. It is actually the inverse of cdf.- Specified by:
quantilein interfaceDistribution
-
M
public DiscreteMixture.Component M(int[] x, double[] posteriori)
Description copied from interface:DiscreteExponentialFamilyThe M step in the EM algorithm, which depends the specific distribution.- Specified by:
Min interfaceDiscreteExponentialFamily- Parameters:
x- the input data for estimationposteriori- the posteriori probability.- Returns:
- the (unnormalized) weight of this distribution in the mixture.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG