What is Covariance: Definition and 171 Discussions

In probability theory and statistics, covariance is a measure of the joint variability of two random variables. If the greater values of one variable mainly correspond with the greater values of the other variable, and the same holds for the lesser values (that is, the variables tend to show similar behavior), the covariance is positive. In the opposite case, when the greater values of one variable mainly correspond to the lesser values of the other, (that is, the variables tend to show opposite behavior), the covariance is negative. The sign of the covariance therefore shows the tendency in the linear relationship between the variables. The magnitude of the covariance is not easy to interpret because it is not normalized and hence depends on the magnitudes of the variables. The normalized version of the covariance, the correlation coefficient, however, shows by its magnitude the strength of the linear relation.
A distinction must be made between (1) the covariance of two random variables, which is a population parameter that can be seen as a property of the joint probability distribution, and (2) the sample covariance, which in addition to serving as a descriptor of the sample, also serves as an estimated value of the population parameter.

View More On Wikipedia.org
  1. docnet

    Please help me understand a definition of a covariance function

    On page 3 of the lecture notes for Stochastic Analysis, it says '##B(s,t)## is the covariance function ##\mathbb{E}[X_sX_t]-\mathbb{E}[X_s]\mathbb{E}[X_t]##. Then On page 5, it says the notes also say that 'the covariance function ##B(s,t)## of a strongly stationary stochastic process is...
  2. pairofstrings

    C# Generic Interfaces and Covariance

    Hi. I have the following code: public interface ICovariance<out T> { void Add(T item); T Get(); } How to remove the compile-time error without changing the code of method declaration and by only changing the interface signature? The error is in:void Add(T item); Thanks.
  3. A

    I The covariance of a sum of two random variables X and Y

    Suppose X and Y are random variables. Is it true that Cov (Z,K) = Cov(X,K)+Cov(Y,K) where Z=X+Y?
  4. F

    A Coefficient correlation between 2 cosmological probes

    Hello, I have the demonstration below. A population represents the spectroscopic proble and B the photometric probe. I would like to know if, from the equation (13), the correlation coeffcient is closed to 0 or to 1 since I don't know if ##\mathcal{N}_{\ell}^{A}## Poisson noise of spectroscopic...
  5. T

    A Contravariance, Covariance, stress and position vector

    Good Morning! I understand that a vector is a physical object I understand that it is the underlying basis that determines how the components transform. However, I encounter this: https://en.wikipedia.org/wiki/Covariance_and_contravariance_of_vectors The fifth paragraph has this statement A...
  6. SchroedingersLion

    A Covariance of Posterior Predictive Distribution

    Greetings! I believe I found an error in a paper to Bayesian neural networks. I think the expression of the covariance of the posterior predictive is wrong, and I wrote down my own calculation. Would be great if a seasoned Bayesian could take a look. Imagine a regression scenario. We want to...
  7. BWV

    Negative eigenvalues in covariance matrix

    Trying to run the factoran function in MATLAB on a large matrix of daily stock returns. The function requires the data to have a positive definite covariance matrix, but this data has many very small negative eigenvalues (< 10^-17), which I understand to be a floating point issue as 'real'...
  8. F

    Problem calculating eigenvalues and eigenvectors

    Hello everyone. I am trying to construct a functioning version of randomfields (specifically 2D_karhunen_loeve_identification_example.py) in Matlab. For that, I have to calculate the Karhunen-Loève expansion of 2D data, since this is what it says in the documentation. I also have some sample...
  9. F

    MATLAB Can I calculate the covariance matrix of a large set of data?

    Hello everyone. I want to calculate the covariance matrix of a stochastic process using Matlab as cov(listOfUVValues) being the dimensions of listOfUVValues 211302*50. I get the following error: Requested 211302x211302 (332.7GB) array exceeds maximum array size preference. Creation of...
  10. F

    A Computing a variance in astrophysics context

    Below the error on photometric galaxy clustering under the form of covariance : $$ \Delta C_{i j}^{A B}(\ell)=\sqrt{\frac{2}{(2 \ell+1) f_{\mathrm{sky}} \Delta \ell}}\left[C_{i j}^{A B}(\ell)+N_{i j}^{A B}(\ell)\right] $$ where ##_{\text {sky }}## is the fraction of surveyed sky and ##A, B##...
  11. M

    MHB No problem! Happy to help. (Smile)

    Hey! :giggle:Let $X_1, \ldots , X_n$ be independent, identically distributed random variables with $$P(X_i=-1)=P(X_i=1)=\frac{1}{2}$$ We consider the random variables $Y_i=\max \{X_i,X_{i+1}\}$, $i=1,\ldots , n-1$. (a) Determine the distribution of $Y_i$, $i=1,\ldots , n-1$. (b) Calculate the...
  12. M

    MHB Distribution, expected value, variance, covariance and correlation

    Hey! :giggle: Let $X$, $Y$ and $Z$ be independent random variables. Let $X$ be Bernoulli distributed on $\{0,1\}$ with success parameter $p_0$ and let $Y$ be Poisson distributed with parameter $\lambda$ and let $Z$ be Poisson distributed with parameter $\mu$. (a) Calculate the distribution...
  13. F

    A Make cross-correlations between 2 Fisher or 2 Covariance matrices

    I have 2 Fisher matrixes which represent information for the same variables (I mean columns/rows represent the same parameters in the 2 matrixes). Now I would like to make the cross-correlations synthesis of these 2 matrixes by applying for each parameter the well known formula (coming from...
  14. N

    A General Covariance in Quantum Field Theory

    All physical laws have to be Lorentz invariant according to a lecture I just watched. Why is general covariance (which is more general than Lorentz invariance) not a requirement for all laws of physics? Are there any quantum gravity theories that take the approach of adding general covariance to...
  15. M

    I Weird covariance matrix for linear fit

    Hello! I really don't know much about statistics, so I am sorry if this questions is stupid or obvious. I have this data: ##x = [0,1,2,3]##, y = ##[25.885,26.139,27.404,30.230]##, ##y_{err}=[1.851,0.979,2.049,6.729]##. I need to fit to this data the following function: $$y = a (x+0.5)/4.186 +...
  16. S

    Covariance of Newton's 2nd Law under Galilean boosts

    I'm reading a section in a textbook on the explanation of covariance of Newton's 2nd law under Galilean boosts. It's explained that ##\mathbf{a}=\mathbf{a'}## (where we're considering two frames ##S## and ##S'## moving inertially w.r.t. each other). Mass is assumed to not vary across the frames...
  17. C

    I Correlations vs. negligence of correlations in a covariance matrix

    Suppose I have a model composed of two parameters ##(a,b)## that I want to describe a set of data points with. In CASE A, I fit the model taking into consideration the correlations between the data points (that is, in the chi square formulation I use the full covariance matrix for the data) and...
  18. C

    I Determining the covariance of two parameters given their explicit relationship

    I am wondering if it is possible to determine the covariance, ##\text{Cov}(a,b)##, of two fitted parameters given I know their explicit relationship ##a=a(b)##? I would like to construct the covariance matrix in the space of the parameters ##\left\{a,b\right\}##. Using the relationship...
  19. H

    What is the inverse of the covariance operator in Brownian motion?

    in fact the answer is given in the book (written by philippe Martin). we have $$ (\tau_1| A^{-1} | \tau_2) = 2D \ min(\tau_1 ,\tau_2) = 2D(\tau_1 \theta (\tau_2 -\tau_1)+\tau_2 \theta (\tau_1 -\tau_2))$$ So $$-1/2D \frac{d^2}{d\tau_1^2} (\tau_1| A^{-1} | \tau_2) = \delta( \tau_1 - \tau_2) $$...
  20. M

    I Scaling covariance for an error calculation

    Hello! I just discovered (maybe a bit late) that most fitting programs (Python lmfit or scipy, for example) have a parameter (by default turned on) that allows a scaling of the covariance matrix for calculating the errors (usually called scale_covar or something similar). After some reading I...
  21. chaksome

    B How to understand 'covariance' and 'contravariance'

    When I come into contact with these two concept in the book of Landau, I gradually know how to use ##A^i or A_i## to simplify the calculation in special relativity. But I found it hard to give an explicit explanation for them(including gauge matrix) in the aspect of physics. Could you please...
  22. redtree

    I Covariance of Fourier conjugates for Gaussian distributions

    Given two variables ##x## and ##k##, the covariance between the variables is as follows, where ##E## denotes the expected value: \begin{equation} \begin{split} COV(x,k)&= E[x k]-E[x]E[k] \end{split} \end{equation} If ##x## and ##k## are Foureir conjugates and ##f(x)## and ##\hat{f}(k)## are...
  23. F

    A Covariance matrix size: 3x3 or 4x4?

    Hello, I follow the post https://www.physicsforums.com/threads/cross-correlations-what-size-to-select-for-the-matrix.967222/#post-6141227 . It talks about the constraints on cosmological parameters and forecast on futur Dark energy surveys with Fisher's matrix formalism. Below a capture of...
  24. V

    Is this formula for covariance wrong?

    Is the attached formula for covariance wrong? Fairly certain it is but want to double check as it seems an odd mistake to make in a paper. I am fairly certain it is wrong. The y_bar should be replaced with (y - y_bar) in the calculated of chi-squared.
  25. B

    A Covariance of equal time commutation relations

    I have a question regarding the covariance of the equal time commutation relations in relativistic quantum field theory. In the case of a scalar field one has that the commutator is (see Peskin, pag. 28 eq. (2.53) ) $ [\phi(0), \phi(y)] = D(-y) - D(y) $ is an invariant function, which is zero...
  26. F

    Calculating the covariance of two discrete random variables

    Homework Statement If the random variables T and U have the same joint probability function at the following five pairs of outcomes: (0, 0), (0, 2), (-1, 0), (1, 1), and (-1, 2). What is the covariance of T and U? Homework Equations σxy = E(XY) - μx⋅μy The Attempt at a Solution My issue with...
  27. Ken Gallock

    I Covariance Matrices and Standard form

    Hi. I have a question about covariance matrices (CMs) and a standard form. In Ref. [Inseparability Criterion for Continuous Variable Systems], it is mentioned that CMs ##M## for two-mode Gaussian states can be symplectic transformed to the standard form ##M_s##: ## M= \left[ \begin{array}{cc}...
  28. mjda

    I Covariance and invariance

    Can anyone briefly explain the difference between covariance and invariance in terms of special relativity? My understanding is that an invariant quantity is a value which does not change regardless of frame of reference it is being measured in. Covariance is a value which when measured in...
  29. S

    I Exploring Base Vectors in Covariance and Contravariance: A Brief Overview

    I'm confused at how the base vectors are found for both. e(1) = ∂r/∂u e(1)= ∇u where r = xi + yj+zk x = x(u,v,w) y=y"" z=z"" cant understand why.
  30. S

    Covariance of partitioned linear combination

    Homework Statement Given random vector ##X'=[X_1,X_2,X_3,X_4]## with mean vector ##\mu '_X=[4,3,2,1]## and covariance matrix $$\Sigma_X=\begin{bmatrix} 3&0&2&2\\ 0&1&1&0\\ 2&1&9&-2\\ 2&0&-2&4 \end{bmatrix}.$$ Partition ##X## as $$X=\begin{bmatrix} X_1\\X_2\\\hline X_3\\X_4\end{bmatrix}...
  31. bhobba

    A Difference Between Covariance and Diffeomorphism Invarience

    Hi I have studied GR form a number of sources - my favorite being Wald - he uses Diffeomorphism Invarience, the rest General Covarience/Invarience. Wald is more mathematically sophisticated but at rock bottom is there really any difference. My suspicion is Wald does it because there is a...
  32. S

    I Covariance & Contravariance of Vectors

    I don't know whether my question is write or not. Is there any way to obtain the covariant component of the same vector $$\vec{V}$$? or is it just the components when written in terms of spherical coordinate unit vectors?
  33. F

    I Questions about the general principle of relativity

    One of the founding principles in GR is the principle of general relativity, which loosely states that all coordinate frames (inertial and non-inertial) are equivalent in the sense that the laws of physics are invariant. My question is, does the justification for this come from Einstein's...
  34. C

    Conservation of Linear Momentum and Covariance

    Homework Statement Assume two masses m1' and m2' are moving in the positive x-direction with velocities v1' and v2' as measured by an observer in S' before a collision. After the collision, the two masses stick together and move with velocity v' in S'. Show that if an observer in S' finds...
  35. topolosaurus

    I Covariance of Euler-Lagrange equations for fields

    \newcommand{\dep}[1]{\partial_{#1}} \newcommand{\parcial}[2]{\frac{\partial{#1}}{\partial{#2}}} \renewcommand{\d}{\text{d}} \newcommand{\ddt}{\frac{\text{d}}{\text{d}t}} \newcommand{\ppartial}[3]{\frac{\partial^2{#1}}{\partial{#2}\partial{#2}}} I haven't found this problem solved around maybe...
  36. D

    MHB Does the magnitude of covariance have any real meaning?

    The title of the question may not be clear. But that is the real difficulty I am facing. I am not able to understand logic behind coming up with this formula for covariance. We know that the sample covariance formula is:- cov(x,y)=\frac{\sum(x_i - \bar{x})(y_i - \bar{y})}{n-1} I am not able...
  37. mfb

    A Covariance matrix for transformed variables

    This sounds like a common application, but I didn't find a discussion of it. Simple case: I have 30 experimental values, and I have the full covariance matrix for the measurements (they are correlated). I am now interested in the sum of the first 5 measured values, the sum of the following 5...
  38. N

    A Expectation operation for covariance calculation

    Hi, If E[wwH]=T, where w is a zero-mean row-vector and H is the Hermitian transpose then assuming that H is another random matrix, it holds that E[H w (H w)H] = T H HH or T E[H HH] ?? In other words, the expectation operation still holds as in the latter expression or vanishes as in the...
  39. pluviosilla

    I Slope of LS line = Cov(X,Y)/Var(X). Intuitive explanation?

    The slope of a fitted line = Cov(X,Y)/Var(X). I've seen the derivation of this, and it is pretty straightforward, but I am still having trouble getting an intuitive grasp. The formula is extremely suggestive and it is bothering me that I can't quite see its significance. Perhaps, my mental...
  40. perplexabot

    A Conditional expectation and covariance of function of RVs

    Hey all, I have been doing some math lately where I need to find the conditional expectation of a function of random variables. I also at some point need to find a derivative with respect to the variable that has been conditioned. I am not sure of my work and would appreciate it if you guys can...
  41. S

    I Covariance in fitting function

    Hello! I have to calculate the covariance between 2 parameters from a fit function. I found this package in Python called iminuit that did a good fit and also calculate the covariance matrix of the parameters. I tested the package on a simple function and I am not sure I understand the result...
  42. JulienB

    I Estimating the covariance

    Hi everybody! I have to write a protocole for our last experiment about elasticity and torsion (in physics), and as an extra question I am asked to calculate the Poisson ratio and to calculate the correlated error by estimating the covariance. Unfortunately I have never done that before, and I...
  43. J

    Covariance and correlation coefficient

    How do you prove that the maximum value of 2*cov(x,y) can be is equal to var(x) + var(y). Moreover, how do you prove that the correlation coefficient, cov(x,y)/(sigma(x)*sigma(y), can only be between -1 and 1.
  44. Y

    Complex Covariance: Analyzing X & Y Relationships

    Apologies for misleading title 1) Let's say I have some process e.g. an gravitational orbit or something that results in x = sin(w t) and y = cos (w t) 2) a. Clearly x and y are related, but using a simple correlation <x|y>/(<x^2><y^2>)**0.5 will result in 0. That is, x and y are not...
  45. M

    Gauss-Markov process covariance function

    Hi all. I've been getting up to speed with Gaussian processes (https://en.wikipedia.org/wiki/Gaussian_process), and was interested to know what properties a Gaussian process must satisfy for it to also be a Markov process (https://en.wikipedia.org/wiki/Markov_process). Briefly, a Gaussian...
  46. Daaavde

    Covariance matrix with asymmetric uncertainties

    Hello everyone, I'm currently building the covariance matrix of a large dataset in order to calculate the Chi-Squared. The covariance matrix has this form: \begin{bmatrix} \sigma^2_{1, stat} + \sigma^2_{1, syst} & \rho_{12} \sigma_{1,syst} \sigma_{2, syst} & ... \\ \rho_{12} \sigma_{1,syst}...
  47. N

    Relation between covariance and rank

    Hi, Assume a matrix H n\times m, with random complex Gaussian coefficients with zero-mean and unit-variance. The covariance of this matrix (i.e., expectation [HHH]) assuming that m = 1 is lower than another H matrix when m > 1 ?? If this holds, can anyone provide a related reference? Thanks...
  48. R

    Kalman filter a posteriori estimate covariance matrix

    I am having some trouble deriving the a posteriori estimate covariance matrix for the linear Kalman filter. Below I have shown my workings for two methods. Method one is fine and gives the expected result. Method two is the way I tried to derive it initially before further expanding out terms to...
  49. S

    What is the Principle of General Covariance in Physics?

    Hello! I am reading GR and got confused about the principle of General Covariance. The principle of General Covariance says that the laws of physics take the same form in all reference frames. Since the laws are same in all reference frames, any experiment performed should give identical...
  50. VintageGuy

    Tensor indices (proving Lorentz covariance)

    Homework Statement [/B] So, I need to show Lorentz covariance of a Proca field E-L equation, conceptually I have no problems with this, I just have to make one final step that I cannot really justify. Homework Equations "Proca" (quotation marks because of the minus next to the mass part, I...
Back
Top