Questions tagged [covariance-matrix]
113 questions
0
votes
1 answer
why multiply covariance matrix by 2 in lmfit error calculation
When I looked into how the error calculation is done for lmfit when we fit functions, I found that the covariance matrix is calculated as the inverse of Hessian Matrix * 2. Then, the error on each parameter is calculated as the sqrt of the…

Sara S
- 101
- 1
- 4
0
votes
0 answers
How can I use a custom covariance matrix in nlme for random effect modelling
I have created a custom covariance matrix (converted to correlation matrix) that I wish to you in nlme. How do use I fit my model as random effect model where gen, rep:row and rep:col are all considered random effects. See below my gls…

Fola
- 9
- 1
0
votes
1 answer
Is it possible to have a covariance matrix without inverse using numpy?
I have the following problem: I need the inverse of the covariance matrix using the following data:
x = [255, 239, 213]
y = [255, 240, 245]
I get the following covariance matrix using numpy.cov()
cov_matrix = np.cov(np.array([[255.0, 255.0], [239.0,…

Giuseppe Boezio
- 101
- 1
- 11
0
votes
2 answers
Plot existing covariance dataframe
I have computed a covariance of 26 inputs from another software. I have an existing table of the results. See image below:
What I want to do is enter the table as a pandas dataframe and plot the matrix. I have seen the thread here: Plot correlation…

Nikko
- 1,410
- 1
- 22
- 49
0
votes
0 answers
How to get r-squared using the covariance matrix output of scipy.optimize.curve_fit?
The scipy.optimize.curve_fit outputs covariance matrix, see scipy.optimize.curve_fit. I wish to get a single float description of the fitting result and I was use to compare r-squared, the coefficient of determination.
How to get r-squared using the…

enoquoley
- 21
- 5
0
votes
0 answers
Can we aggregate two columns of covariance matrix into one such that if initial matrix 3x3 then final aggregated matrix is 2x2?
I have to aggregate two columns of cov into one
| 1.2 0.3 0.8 |
| 0.3 0.9 0.1 |
| 0.8 0.1 1.6 |
I would like 2x2 matrix by combining first two columns into one
I would like 2x2 matrix by combining first two columns into one

Sravan Gajula
- 9
- 3
0
votes
0 answers
R: Computing covariance matrix of a large dataset
I'm trying to compute the covariance matrix of a very large image data matrix. I have tried both
cov(data)
and
data %*% t(data)/ (nrow(t(data))-1)
and ended up with a matrix of NaN values which makes absolutely no sense. The size of the covariance…

darzan
- 17
- 4
0
votes
0 answers
P-value is equal to NaN in covmtest
I have a dataset that has daily data about Covid19 for many countries. I want to group them in such a way that the first country has the number one, the second country has the number two and so on. For this I have wrote the below…

Billy
- 27
- 7
0
votes
1 answer
How to get the within-group variance-covariance matrix in statsmodels MANOVA, Python?
I am trying to extract the within-group variance-covariance matrix to estimate the flatness in a MANOVA model in statsmodels using the following formula:
I've been reading through the statsmodels user guide, but haven't come across it.
What I have…

GSA
- 751
- 8
- 12
0
votes
0 answers
Matlab - determinant of covariance matrix coming out as zero
I'm trying to calculate the determinant of a 171x171 covariance matrix in matlab but the determinant is coming out as zero. I know the matrix is not singular because I am able to calculate the inverse of the matrix but because the numbers in the…

climatecode44
- 13
- 2
0
votes
0 answers
Deriving data from a multivariate normal distribution according to a specific correlation matrix in r
I derive data from a multivariate normal distribution. I created the correlation structure I wanted by the sigma matrix. Since I take the standard deviation as 1, I expect the Sigma matrix and correlation of Z matrix to be the same, but it is not…

Bugra Varol
- 53
- 5
0
votes
0 answers
SSM model Standard errors Matlab covariance matrix
Does anybody know please how to obtain standard errors of estimates parameter in SSM model matlab? or how to get them from covariance matrix?

Marcelo Dorelis
- 1
- 1
0
votes
1 answer
Why isn't my Matlab code for a randomly generated covariance matrix making a positive definite matrix?
Here is my code. I'm getting an error that when I use chol(V) that V is not positive definite. I would think that by construction it must be positive definite. Any idea what's going wrong?
% I want 10000 draws of a 5x1 multivariate normal…

giants4210
- 31
- 2
0
votes
1 answer
Error message in R: not a symmetric or triangular matrix
I am trying to convert a correlation matrix to a covariance matrix using cor2cov in R.
library(MBESS)
eff_1971 <- c(NA, .56, .25, .25, .22, -.47, -.01, -.06)
eff_1972 <- c(NA, NA, .23, .23, .25, .47, -.01, .03)
annual_earnings_1970 <- c(NA, NA, NA,…

jo_
- 677
- 2
- 11
0
votes
1 answer
Manually creating a correlation matrix in R
I have a correlation table from a book that I want to import into R.
The ultimate goal is to convert this correlation matrix into a covariance matrix using the cor2cov function. However, in order to do that, I need to read in all these values into…

jo_
- 677
- 2
- 11