Questions tagged [covariance-matrix]
113 questions
7
votes
1 answer
How to use a lasso with the Vars package?
I'm trying to analyze a high dimensional data set (31 variables, 1100 observations) through a penalized vector autoregression.
Since I'm using the techniques introduced by Diebold et. al (2019) to build a network of connectedness through variance…

Manfretto
- 83
- 5
5
votes
0 answers
Project ellipsoid with 7 parameter camera
I have a function which projects a point using a 7 parameter camera model:
Vec2 project(const Rot3& R, // camera orientation
const Vec3& T, // camera pos
double f_px, // focal length
const Vec3& X) // point…

bgp2000
- 1,070
- 13
- 32
4
votes
1 answer
Matplotlib - Python- GetDist tool - Overlapping 2 triangle plots (triplots) by calling twice the plot function: issue of visible priority between both
In python3, I am faced to 2 issues using the tool GetDist tool to produce triplot of covariance matrix.
1) Currently, I can plot 2 covariance matrixes on the same figure by only one call of the plotting function (triangle_plot). Specifying as first…
user1773603
3
votes
2 answers
Can't calculate np.cov() correctly
This question might be silly, but i couldn't find an explanation to that.
I am coding the multivariate probability density function from scratch (for study purposes), and one of the things that i need to compute is the covariance matrix of data. I…

heresthebuzz
- 678
- 7
- 21
3
votes
1 answer
How to calculate the 3x3 covariance matrix for RGB values across an image dataset?
I need to calculate the covariance matrix for RGB values across an image dataset, and then apply Cholesky decomposition to the final result.
The covariance matrix for RGB values is a 3x3 matrix M, where M_(i, i) is the variance of channel i and…

ProGamerGov
- 870
- 1
- 10
- 23
3
votes
0 answers
felm function: Negative eigenvalues in multiway clustered variance matrix
I'm running following regression using felm() function in R and receiving following warning messages:
malmquist.felm <- felm(malmquist~ IT + logTA + npl | firm + year | 0 | firm + year , data=Data)
Warning message:
In newols(mm, nostats =…

mary
- 63
- 4
3
votes
2 answers
Finding inverse matrix in R
I have a variance covariance matrix S:
> S
[,1] [,2]
[1,] 4 -3
[2,] -3 9
I am trying to find an inverse of it.
The code I have is:
>invS <- (1/((S[1,1]*S[2,2])-(S[1,2]*S[2,1])))*S
[,1] [,2]
[1,] 0.1481481…

Feyzi Bagirov
- 1,292
- 4
- 28
- 46
3
votes
1 answer
How to calculate the Standard error from a Variance-covariance matrix?
I am calculating a variance-covariance matrix and I see two different ways of calculating the standard errors:
sqrt(diagonal values/number of observations)
e.g. standard deviation / sqrt(number of observations)
(as is given from on how to…

Laurence_jj
- 646
- 1
- 10
- 23
3
votes
1 answer
interpretation of covariance result matrix
I'm trying to make sense out of reading the result of a covariance matrix. I know if the resulting signs are both >0 then it means the arrays are moving in the same direction.
x = np.array([[10,39,19,23,28],
[43,13,32,21,20],
…

dirtyw0lf
- 1,899
- 5
- 35
- 63
2
votes
3 answers
r long to wide and covariance matrix
This is my dataset,
df1 <- "ID t res
1 1 -1.5
1 2 -1.5
1 3 0.5
1 4 0.5
2 1 -0.5
2 2 -0.5
2 3 -2.0
2 4 …

Ahir Bhairav Orai
- 611
- 1
- 7
2
votes
0 answers
What is model.cov_params() in statsmodels?
I am unable to understand what the [cov_params][1] from a fitted statsmodel represents. I thought it would be the covariance matrix of the data but that does not seem to be the case. It is not even scale*convariance_matrix_of_the_data
I have used…

figs_and_nuts
- 4,870
- 2
- 31
- 56
2
votes
0 answers
rmvnorm warning message: sigma is numerically not positive semidefinite
I am trying to set up a parametric bootstrap using the mean and covariance matrix from my model fitted with nlm() which converged with code 1. However, when creating new parameters using
rmvnorm(1,mean=mod$estimate,sigma=solve(mod$hessian))
I get…

Cornelia Oedekoven
- 21
- 1
2
votes
0 answers
What does it mean when a covariance matrix values are all the same in hmmlearn - GMMHMM?
I am working with GMMHMM from hmm learn for speaker recognition. After training the model, I found that all the values in the covariance matrix (covars_) all have the same values.
I initialised my hmm as follows
model = hmm.GMMHMM(n_components=5,…

Niceta Nduku
- 21
- 1
2
votes
0 answers
PCA without covariance matrix?
How is it possible, that i can calculate PCA without Covariance matrix?
The code below do this:
With covariance: i substract the mean of every column and calculate
the cov()-matrix, before i calculate the eigenvalues and
eigenvectors.
Without…

Len01
- 31
- 5
2
votes
1 answer
Computing covariance matrix without using numpy
I am trying to compute the covariance matrix which maximises the likelihood estimate manually without using the numpy library,but I cannot seem to get the right answer. I am trying to go by this formula:
I know i'm calculating the means …

RishtarCode47
- 365
- 1
- 4
- 18