Generate correlated random variables in a wider domain

1 次查看(过去 30 天)
Hi all,
I have a set of correlated data with rho = 0.0206. Each of two variable has a statistical distribution as follows (par = parameter):
WL = ('generalized extreme value',par1 = -0.4241, par2 = 0.6731, par3 = 1.4881)
Hs = ('Generalized Pareto', par1 = -0.0860, par2 = 0.2149, par3 = 1.7000)
when I ran my code to generate 100000 correlated samples, I see that data in X-axis has maximum limit of 3.15 and data in Y-axis has maximum limit of 3.4. I want to increase these limits to 6 but don't how!
Here is my code:
clear all
clc
% Reading raw data
RawData = xlsread('TrHs=1.7m.xlsx');
Hs = RawData(:,2);
WL = RawData(:,1);
n = 100000; % Read number of simulations
rho=0.0206; % Calculate correlation parameter
ro=[1 rho;rho 1];
Z = mvnrnd([0 0], ro, n);
U = normcdf(Z);
WLinv=icdf('generalized extreme value',U(:,1),-0.4241, 0.6731, 1.4881);
Hsinv=icdf('Generalized Pareto',U(:,2),-0.0860, 0.2149, 1.7000);
X = [WLinv Hsinv];
[n1,ctr1] = hist(X(:,1),50);
[n2,ctr2] = hist(X(:,2),50);
plot(X(:,1),X(:,2),'.r'); hold on; plot(WL,Hs,'.b','markersize',12);
legend({'Simulated Data','Raw Data'},'Location','northwest','fontname','times','fontweight','bold','fontsize',10)
title('Monte-Carlo Data Simulation','fontname','times','fontweight','bold','fontsize',12)
ylabel('Significant Wave Height (Hs)','fontname','times','fontweight','bold','fontsize',12)
xlabel('Water Level (WL)','fontname','times','fontweight','bold','fontsize',12)
csvwrite('DataGen1.csv',X) % Write simulated data into an Excel file

回答(1 个)

Jeff Miller
Jeff Miller 2020-1-3
It looks like 3.15 and 3.4 are the maximum values in the generalized extreme value and pareto distributions with the parameters that you have given. If you want to get values up to 6, then you will have to use different parameter values for these distributions. For example, you could get values up to 6 by increasing either of the first two parameters of the generalized extreme value distribution (location, scale)--or both. It is just a question of exactly what distribution parameters you want to use in your simulation.

类别

Help CenterFile Exchange 中查找有关 MATLAB Report Generator 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by