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
variance([2, 4, 4, 4, 5, 5, 7, 9])In the solver,
Open in the solvervariance([2, 4, 4, 4, 5, 5, 7, 9])gives32/7.variance([a, b, c])In the solver,
Open in the solvervariance([a, b, c])gives(a^2 - a*b - a*c + b^2 - b*c + c^2)/3.variance(binomial_distribution(n, p))In the solver,
Open in the solvervariance(binomial_distribution(n, p))givesn*p*(1 - p).variance(uniform_distribution(a, b))In the solver,
Open in the solvervariance(uniform_distribution(a, b))gives(b - a)^2/12.variance(construct(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t))In the solver,
Open in the solvervariance(construct(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t))gives(1/2)sigma^2*(1 - e^(-2t*theta))/theta if theta != 0.variance(geometric_brownian_motion_process(mu, sigma, x0), t)In the solver,
Open in the solvervariance(geometric_brownian_motion_process(mu, sigma, x0), t)givesx0^2*e^(2mu*t)*(e^(sigma^2*t) - 1).variance(wiener_process(mu, sigma), t)In the solver,
Open in the solvervariance(wiener_process(mu, sigma), t)givessigma^2*t.
Functions its examples use
- binomial_distribution
The number of successes in n independent trials that each succeed with chance p.
- uniform_distribution
The continuous distribution that is equally likely anywhere between a and b.
- construct
Apply a head that is itself computed to arguments, as in f'(0) or (x => body)(a).
- ornstein_uhlenbeck_process
A process pulled toward mu at rate theta, with noise sigma, started at x0.
- geometric_brownian_motion_process
A process that grows at rate mu with relative noise sigma, started at x0.
- wiener_process
Brownian motion with drift mu and noise sigma, started at 0.
Related functions
- 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.