Covariance from standard deviation and correlation (covcorr)

This MATLAB function converts standard deviation and the correlation matrix to a covariance matrix
8 téléchargements
Mise à jour 29 jan. 2024

Afficher la licence

This MATLAB function converts standard deviation and correlation to covariance
INPUTS:
psigma = vector of standard deviations for each of any number of variables or parameters
prho = correlation matrix of the correlations between each each variable or parameter
OUTPUTS:
pcov = covariance matrix between variables or parameters
EXAMPLE:
load hospital
X = [hospital.Weight hospital.BloodPressure];
% Find the correlation matrix for the variables X:
prho = corrcoef(X)
% prho =
% 1.0000 0.1558 0.2227
% 0.1558 1.0000 0.5118
% 0.2227 0.5118 1.0000
% Find the standard deviations of each variable X
psigma = std(X)
% psigma =
% 26.5714 6.7128 6.9325
% Find the covariance matrix between variables X:
pcov = covcorr(psigma,prho)
% pcov =
% 706.0404 27.7879 41.0202
% 27.7879 45.0622 23.8194
% 41.0202 23.8194 48.0590

Citation pour cette source

Gregory Pelletier (2024). Covariance from standard deviation and correlation (covcorr) (https://www.mathworks.com/matlabcentral/fileexchange/158046-covariance-from-standard-deviation-and-correlation-covcorr), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2023b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Tags Ajouter des tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version
1.0.3

updated title

1.0.2

updated readme

1.0.1

updated readme

1.0.0