geostat

Geometric mean and variance

Syntax

[m,v] = geostat(p)

Description

[m,v] = geostat(p) returns the mean m and variance v of a geometric distribution with corresponding probability parameters in p. p can be a vector, a matrix, or a multidimensional array. The parameters in p must lie in the interval [0,1].

Examples

collapse all

Define a probability vector that contains six different parameter values.

p = 1./(1:6)
p = 1×6

    1.0000    0.5000    0.3333    0.2500    0.2000    0.1667

Compute the mean and variance of the geometric distribution that corresponds to each value contained in probability vector.

[m,v] = geostat(1./(1:6))
m = 1×6

         0    1.0000    2.0000    3.0000    4.0000    5.0000

v = 1×6

         0    2.0000    6.0000   12.0000   20.0000   30.0000

The returned values indicate that, for example, the mean of a geometric distribution with probability parameter p equal to 1/3 is 2, and its variance is 6.

More About

collapse all

Geometric Distribution Mean and Variance

The mean of the geometric distribution is mean=1pp, and the variance of the geometric distribution is var=1pp2, where p is the probability of success.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a