CAlculating Gaussian Copula but shows error
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Nirajan Khatri
 el 28 de Sept. de 2020
  
    
    
    
    
    Respondida: Ameer Hamza
      
      
 el 28 de Sept. de 2020
            clc;
N = 1000;
norm_mean = 0;
norm_var = 1;
%generating random variable with standard normal distribution and
%calculating PDF
r1= norm_mean+sqrt(norm_var)*randn(1,N);
%calculating PDF
y1 = pdf('Normal',r1,norm_mean,sqrt(norm_var));
%Random variable 2
r2= norm_mean+sqrt(norm_var)*randn(1,N);
y2 = pdf('Normal',r2,norm_mean,sqrt(norm_var));
%Random Variable 3
r3= norm_mean+sqrt(norm_var)*randn(1,N);
y3 = pdf('Normal',r3,norm_mean,sqrt(norm_var));
%Calculate correlation between columns Y1 and Y2
)
[rho,pval] = corr([y1(:),y2(:)],y3(:),'type','Spearman')
%Calculating correlation between Y1 and Y2 and Y3 using corrcoef
[r,p] = corrcoef(y1(:),y2(:)) %%Cannot calculate it 
%calculating Gaussian/Normal copula
u = copularnd('Gaussian',rho,N); %%Cannot calculate it 
0 comentarios
Respuesta aceptada
  Ameer Hamza
      
      
 el 28 de Sept. de 2020
        Why are you specifying y3, when trying to calculate the correlation of y1 and y2. The following line will work fine with copularnd
rho = corr([y1(:),y2(:)],'type','Spearman');
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Copula Distributions and Correlated Samples en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

