Accelerating the pace of engineering and science

# 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

expand all

### Compute Mean and Variance of Geometric Distribution

Define a probability vector that contains six different parameter values.

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

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 =

0    1.0000    2.0000    3.0000    4.0000    5.0000

v =

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.

expand all

### Geometric Distribution Mean and Variance

The mean of the geometric distribution is

$\text{mean}=\frac{1-p}{p}\text{\hspace{0.17em}},$

and the variance of the geometric distribution is

$\mathrm{var}=\frac{1-p}{{p}^{2}}\text{\hspace{0.17em}},$

where p is the probability of success.