Questions tagged [covariance-matrix]
113 questions
1
vote
0 answers
Simulating Gaussian Fractional Noise
I am trying to generate Gaussian Fractional Noise using the following code :
#autocovariance of Gaussian Noise
import numpy as np
from scipy.linalg import circulant,eigvals,eig,inv
import matplotlib.pyplot as plt
def autocovG(H,n):
empty_mt =…

lays
- 158
- 1
- 1
- 7
1
vote
1 answer
Multiply Correlation and Volatility Dataframes with Multi-Index to Get Covariance Matrix
I am multiplying a DataFrame of volatilities (rvm) with a DataFrame of correlations (omega_tilde) to obtain a covariance matrix.
The rvm DataFrame (5790 rows × 10 columns):
NoDur Durbl Manuf Enrgy HiTec Telcm Shops …

Bjarne Timm
- 115
- 5
1
vote
0 answers
Getting the origin and orientation of point cloud plane cluster using Covariance Matrix in pcl
I'm facing some troubles for calculation of the orientation of an extracted point cloud plane. The plane is representing the surface of a rectangular part. I need to get origin and orientation to feed the robot in an pick application.
The following…

FireCloud
- 11
- 2
1
vote
1 answer
Is there any way where we can calculate parameter covariance matrix instead of correlation matrix in python lmfit package
I have re-parameterize Arrhenius equation of form k = kref*exp(-E/R((1/T)-(1/Tref)) and i wanted to estimate the values of parameters E & kref which i got from lmfit package and correlations between it too.
However the whole idea of…
user14466123
1
vote
1 answer
Computing covariance matrix of complex array with defined function is not matching while comparing with np.cov
I am trying to write a simple covariance matrix function in Python.
import numpy as np
def manual_covariance(x):
mean = x.mean(axis=1)
print(x.shape[1])
cov = np.zeros((len(x), len(x)), dtype='complex64')
for i in…

SAM
- 43
- 3
1
vote
1 answer
Generating random binary array in numpy with varying probabilities given by indices
I have a symmetric matrix A, with A.shape = (30, 30), and each row of A is associated with one of 3 unique labels [0, 1, 2].
I have another matrix M:
m1 = .9
m2 = .1
M = np.array([[m1, m2, m2],
[m2, m1, m2],
[m2, m2,…

Alex L
- 367
- 2
- 14
1
vote
0 answers
Is this the correct way to calculate the covariance matrix for 2D feature map?
Within a neural network, I have some 2D feature maps with values between 0 and 1. For these maps, I want to calculate the covariance matrix based on the values at each coordination. Unfortunately, pytorch has no .cov() function like in numpy. So I…

spadel
- 998
- 2
- 16
- 40
1
vote
1 answer
R language: Computer Covariance matrices of a 3-d array data
How to use apply() function in r on iris dataset (a 3-d array dataset) to compute covariance matrices of the variables Sepal Length, Sepal Width, Petal Length, and Petal Width for each of the three species Setosa, Versicolor, and Virginica,…

Lucia
- 47
- 6
1
vote
1 answer
R: Need example of performing boxM() with two-way (factorial) MANOVA - I'm getting an error
I am trying to run Box's M-test for Homogeneity of Covariance Matrices, for two-way MANOVA.
I have conducted searches for an example since yesterday afternoon. I see many examples of using boxM with one-way MANOVA. In every case, if the source…

Kyle
- 145
- 7
1
vote
0 answers
Infinite or missing values in 'x' lavaan error
I am sure I am missing something obvious but this is my first time using SEM outside of stats class.
The big picture is that I'm trying to model a multivariate moderated mediation analysis and wasn't having issues until this morning when I started…

leftovercrack
- 11
- 5
1
vote
1 answer
Non-stationary Gaussian covariance function Python
I am trying to implement a non-stationary Gaussian covariance function in Python based on equations (5,6) of Paciorek and Schervish, 2005. See attached image:
I have produced some code which I believe is doing the right thing, although it is very…

Will Gregory
- 43
- 6
1
vote
0 answers
How to plot other dimensions in PCA plot using DISTATIS
I'm wondering how to find the correct eigen values and % of explain variances of my distatis plot. I'm using the package DistatisR.
I have the following code now:
DistanceCube <- DistanceFromSort(*owndata*)
testDistatis <-…

Michèle Brussé
- 11
- 2
1
vote
2 answers
Is there an R package for modified 2-sample Hotelling's T2 test (unequal covariance matrices)?
I need to compare many multivariate means. Usually, I would do this using Hotelling's T-square test statistics.
The original Hotelling's equation is:
T^2 = (nxny/nx+ny) (X-Y)' S^-1 (X-Y)
where X and Y are the vector means, S is the pooled…

TAH
- 120
- 1
- 3
- 11
1
vote
1 answer
Differences between functions to get variance-covariance matrix (var and cova)
I am trying to optimize a function (NbCluster) to be able to handle bigger matrices, something I have posted about previously: Reducing NbClust memory usage
This led me to create a (still very experimental) fork of NbClust, which is here:…

Stonecraft
- 860
- 1
- 12
- 30
1
vote
0 answers
How do I calculate the covariance matrix for a specific centroid (k-means clustering) in Python 3?
I am implementing an algorithm for k-means clustering. So far it works using Euclidean distances. Switching out Euclidean distances for Mahalanobis distances fails to cluster correctly.
For some reason, the Mahalanobis distance is negative at times.…

bestscammer5
- 11
- 2