# 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

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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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...

31. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### I How Do You Estimate Covariance in Physics Experiments?

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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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. ### 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...