sum to dependent normally distrbution

4 views (last 30 days)
Ahmad Nikpour
Ahmad Nikpour on 24 Nov 2021
Answered: Simran on 16 Feb 2025
Dear all
I try to sum to dependent normal distrbution. At first I calculated rank correlation of them. Now I try to sum them by copulas, however I dont know how I can do it.

Answers (1)

Simran
Simran on 16 Feb 2025
I see you want to sum two dependent normal distributions using copulas. To do this you can follow these steps:
1.) First select a copula that fits your dependency structure. It could be a gaussian copula, t-copula etc.
2.) Once you are done with the selection, you can use the chosen copula to simulate correlated random variables. You can also refer to MATLAB’s Statistics and Machine Learning Toolbox documentation to work with copulas-
3.) After you’re done simulating dependent variables, you can sum them directly.
Below is an example I tried to verify the solution:
% Parameters
mu = [0 0]; % Means of the normal distributions
sigma = [1 1]; % Standard deviations
rho = 0.5; % Correlation coefficient
% Create a Gaussian copula
copula = copula('Gaussian', rho);
% Generate random samples
n = 1000; % Number of samples
u = copularnd(copula, n);
% Convert uniform samples to normal samples
x1 = norminv(u(:, 1), mu(1), sigma(1));
x2 = norminv(u(:, 2), mu(2), sigma(2));
% Sum the dependent normal variables
sum_of_normals = x1 + x2;
% Display results
disp('Sum of dependent normal variables:');
disp(sum_of_normals);
You can verify the solution by calculating the correlation of x1 and x2 to ensure it matches the specified rank correlation.
You can also plot a histogram (as I did) of “sum_of_normals” to visually inspect the distribution of summed variable.
You can refer to the below documentation for more information:
Creating and fitting copulas:
Statistics and Machine Learning Toolbox:

Categories

Find more on Probability Distributions and Hypothesis Tests in Help Center and File Exchange

Tags

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!