Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

Variance (variance)

The sample variance of a list of numbers, or the variance of a distribution.

How to write it

variance(data)

The sum of the squared deviations from the mean, divided by n - 1.

data
At least two numbers. Symbols are allowed. Takes a list.

variance(distribution)

The variance of a distribution.

distribution
A distribution such as normal_distribution(mu, sigma). Takes an expression.

variance(process)

The variance of a stochastic process at a time.

process
A process at a time, written construct(p, t), or p(t) for a stored process p. Takes an expression.

variance(process, t)

The same, with the time written beside the process.

process
A process such as geometric_brownian_motion_process(mu, sigma, x0). Takes an expression.
t
The time, a variable or a number. Takes an expression.

Examples

  • 2,4,4,4,5,5,7,9=327\displaystyle 2, 4, 4, 4, 5, 5, 7, 9 = \frac{32}{7}
    variance([2, 4, 4, 4, 5, 5, 7, 9])

    In the solver, variance([2, 4, 4, 4, 5, 5, 7, 9]) gives 32/7.

    Open in the solver
  • a,b,c=a2−ab−ac+b2−bc+c23\displaystyle a, b, c = \frac{a^{2}-a b-a c+b^{2}-b c+c^{2}}{3}
    variance([a, b, c])

    In the solver, variance([a, b, c]) gives (a^2 - a*b - a*c + b^2 - b*c + c^2)/3.

    Open in the solver
  • Var⁡(X), X∼B(n,p)=np(1−p)\displaystyle \operatorname{Var}(X),\ X \sim \mathrm{B}(n, p) = n p (1-p)
    variance(binomial_distribution(n, p))

    In the solver, variance(binomial_distribution(n, p)) gives n*p*(1 - p).

    Open in the solver
  • Var⁡(X), X∼U(a,b)=(b−a)212\displaystyle \operatorname{Var}(X),\ X \sim \mathrm{U}(a, b) = \frac{(b-a)^{2}}{12}
    variance(uniform_distribution(a, b))

    In the solver, variance(uniform_distribution(a, b)) gives (b - a)^2/12.

    Open in the solver
  • construct⁡(OU⁡(μ,σ,θ,x0),t)={σ2(1−1e2tθ)2θif θ≠0\displaystyle \operatorname{construct}(\operatorname{OU}(\mu, \sigma, \theta, x_{0}), t) = \begin{cases} \frac{\sigma^{2} \left(1-\frac{1}{e^{2 t \theta}}\right)}{2 \theta} & \text{if } \theta \neq 0 \end{cases}
    variance(construct(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t))

    In the solver, variance(construct(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t)) gives (1/2)sigma^2*(1 - e^(-2t*theta))/theta if theta != 0.

    Open in the solver
  • Var⁡(Xt), X∼GBM⁡(μ,σ,x0)=x02e2μt(eσ2t−1)\displaystyle \operatorname{Var}(X_{t}),\ X \sim \operatorname{GBM}(\mu, \sigma, x_{0}) = x_{0}^{2} e^{2 \mu t} (e^{\sigma^{2} t}-1)
    variance(geometric_brownian_motion_process(mu, sigma, x0), t)

    In the solver, variance(geometric_brownian_motion_process(mu, sigma, x0), t) gives x0^2*e^(2mu*t)*(e^(sigma^2*t) - 1).

    Open in the solver
  • variance⁡(wiener_process⁡(μ,σ),t)=σ2t\displaystyle \operatorname{variance}(\operatorname{wiener\_process}(\mu, \sigma), t) = \sigma^{2} t
    variance(wiener_process(mu, sigma), t)

    In the solver, variance(wiener_process(mu, sigma), t) gives sigma^2*t.

    Open in the solver

Functions its examples use

  • weibull_distribution

    The lifetime of a unit whose chance of surviving to time x is e^(-(x/scale)^shape).

  • stationary_distribution

    The law a process settles into over time, when it has one.

  • affine_sde_moments

    The mean and variance at time t of dX = (a + b X) dt + sigma dW, started at x0.

  • standard_deviation

    The sample standard deviation of a list of numbers, or that of a distribution.

  • quantile

    The smallest value with at least a share q of a list, or a chance q of a distribution, at or below it.

  • cdf

    The probability that a variable with a distribution is at most a value.