Simulating dependent normally distributed variables using copulas
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Tom Lane
el 17 de Dic. de 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 comentarios
Ver también
Categorías
Más información sobre Copula Distributions and Correlated Samples en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!