Questions tagged [covariance-matrix]
113 questions
0
votes
1 answer
Getting normal matrix or variance-covariance matrix of scipy's LSQUnivariateSpline or make_lsq_spline (in case of given weights)
I am using LSQUnivariateSpline or make_lsq_spline from scipy.interpolate for given weights.
Is there a simple way to get not only the resulting spline, but also the variance-covariance matrix of the spline coefficients?
Is there a simple way to get…

Thomas Hilger
- 456
- 3
- 11
0
votes
1 answer
How to generate distinct covariance matrices for each class in SAS?
Using SAS I want to generate the covariance matrices for a dataset which contains a binary class, one covariance matrix for class 1 and one covariance matrix for class 2.
PROC MEANS DATA=my_dataset MAXDEC=2 MEAN STD;
CLASS binary_class;
VAR x1 x2…

Javide
- 2,477
- 5
- 45
- 61
0
votes
0 answers
How to use PCA with data of values with same units
My data consists of 400000 samples with 3200 values of same units (400000x3200). I know, when the data has values of different size, first you have to standardize or normalize the data, so the scale of each value is the same.
But how to calculate…

Len01
- 31
- 5
0
votes
0 answers
Fitting multivariate mixed models with continuous and ordinal dependent variables
I would like to run a multivariate mixed regression MCMC model with two response (independent) variables, namely Boldness scores (continuous variable) and Aggression ranks (ordinal ranks). Trial numbers (integers) are the fixed effect while…

BP86
- 1
- 1
0
votes
0 answers
Is PCA possible in 2x2 matrix taken from 3x3 population covariance matrix
Population matrix is given as below:
May I know if I want only first two Principal Components, PC1 and PC2, can I make the matrix as 2x2 matrix below to perform calculation of eigen vectors?
0
votes
2 answers
constructing variance-covariance matrix from pairwise correlation data in R
I have all the pairwise correlations and would like to construct the var-covariance matrix in order to do some standard analysis on that matrix. Here's a sample data for the covariances, the first two columns are the "ids" while the third column…

Raimundo
- 139
- 1
- 8
0
votes
1 answer
LDA covariance matrix not match calculated covariance matrix
I'm looking to better understand the covariance_ attribute returned by scikit-learn's LDA object.
I'm sure I'm missing something, but I expect it to be the covariance matrix associated with the input data. However, when I compare .covariance_…
0
votes
0 answers
How to calculate "A" in R's fastSOM package?
I'm very new to R and need to calculate some things for my thesis with the fastSOM package.
I already created the necessary cov matrix (4x4 matrix).
Now to run the calculation for the spillovers, I need a variable "A".
As stated in the package…

Economist93
- 1
- 2
0
votes
1 answer
np.cov giving unexpected number of values
When using np.cov command on a random dataset of 10 values, I'm getting a 10x10 array as the answer. I think my data is not formatted correctly, but I'm not sure.
np.random.seed(1)
rho = 0.2
sigma = 1
cov = (sigma**2)*[[1,rho],[rho,1]]
mean1 =…

amb50531
- 9
- 3
0
votes
0 answers
Plotting the off-diagonal value of a covariance matrix
This block of code outputs all 10 of my covariance matrices and plots every point in the 2x2 matrix.
for i in range(10):
columns = datawithoutmean[:, i*2:i*2 + 2]
cov = numpy.cov(columns.T)
print(cov)
…

tonyferguson24
- 1
- 1
0
votes
1 answer
np.cov() matrix returns unexpected values
I am trying to find the covariance matrix of all possible images(flattened) with each pixel - {0,1}.
I have written following code using numpy:
import numpy as np
a = np.array(np.meshgrid([1,0], [1, 0], [1, 0],[1,0],[0,1])).T.reshape(-1,5)
a =…

daya
- 9
- 3
0
votes
0 answers
How can I get the covariance matrix of the coefficients when running a linear regression?
I'm running a multiple linear regression with the lm() function and I would like to get the covariance matrix of the estimated coefficients. How can I do that?
Here Covariance (or correlation) matrix of coefficients in lme there is an answer for the…

Iro
- 11
- 1
0
votes
0 answers
I want to put factor scores of different indicators in a data frame for factor score path analysis
I am doing factor score path analysis
I am doing factor score path analysis for a latent variable and so I did factor score analysis to generate factor scores. Now I want to generate a variance-covariance matrix so I want to put the factor scores I…
0
votes
0 answers
Looking for variation accounted for by each principal coordinate (component, axis, etc.) in principal coordinates of neighborhood matrix analysis
After completing the pcnm analysis on the set of data I can call on all of the axes and kick out the newly created standarized values from the analysis. However, before I go putting these values into multiple regression or other analyses I would…

Matthew Acre
- 31
- 2
0
votes
1 answer
How to create a rolling window covariance matrix and calculate the respective weights?
I tried to create covariance matrices over an rolling window to calculate the portfolio weights for the next period of time.
covMat = cov(mon_ret) ;
[corMat, std] = corrcov(covMat);
port_size = length(covMat) ;
Aeq =…

Dirty Dan
- 15
- 5