Simulating dependent normally distributed variables using copulas
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I created a model that simulates variables with kernel distributions connected by copula functions. (X and Y are series of ln returns)
It looks like this: kX = ksdensity(X,X,'function','cdf'); kY = ksdensity(Y,Y,'function','cdf'); [Rho,nu] = copulafit('t',[kX kY],'Method','ApproximateML'); r = copularnd('t',Rho,nu,100000); XX = r(:,1); YY = r(:,1); SX = ksdensity(X,XX,'function','icdf'); SY = ksdensity(Y,YY,'function','icdf'); SimX = a*exp(SX); SimY = b*exp(SY);
Now I wish to evaluate the results when modeling the variables as normally distributed. I can’t see what function can directly substitute ksdensity in the model. I was trying to do this with:
kX = normcdf(X); kY = normcdf(Y); [Rho,nu] = copulafit('t',[kX kY],'Method','ApproximateML'); r = copularnd('t',Rho,nu,100000); XX = r(:,1); YY = r(:,1); SX = norminv(X,XX); SY = norminv(Y,YY); SimX = a*exp(SX); SimY = b*exp(SY);
But is not working because norminv does not support the second argument with the copula function. I am seeing this right? What can I do?
Thank you very much,
0 Kommentare
Antworten (1)
Tom Lane
am 17 Dez. 2014
Consider formatting your question so the code is not wrapped into the text.
The syntax ksdensity(x,xx) computes a kernel density based on x, evaluated at xx. If you intend to use the standard normal distribution, I believe you want just norminv(xx) .
0 Kommentare
Siehe auch
Kategorien
Mehr zu Copula Distributions and Correlated Samples finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!