Correlation coefficient (correlation)
The correlation coefficient of two lists of the same length.
How to write it
correlation(xs, ys)
The covariance over the product of the standard deviations, from -1 to 1.
- xs
- The first list. Takes a list.
- ys
- The second list, as long as the first. Takes a list.
Examples
correlation([1, 2, 3, 4], [2, 4, 5, 9])In the solver,
Open in the solvercorrelation([1, 2, 3, 4], [2, 4, 5, 9])gives11sqrt(130)/130.
Related functions
- covariance
The sample covariance of two lists of the same length.
- cdf
The probability that a variable with a distribution is at most a value.
- cvar
The conditional value at risk of a loss: its expected value over the worst share 1 - level.
- binomial_distribution
The number of successes in n independent trials that each succeed with chance p.
- distributed
A variable and the distribution it follows, as probability and expectation read it.
- affine_sde_moments
The mean and variance at time t of dX = (a + b X) dt + sigma dW, started at x0.