Graph Condtional Moments
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Graph Condtional Moments
Dear Tom,
Hope all is well. I have difficulty with graphing the conditional moments, please see attached code along with the data. When I use the instruction TABLE to display the data, I see that e.g rho1 shows 0 number of observations while rho2 has 427, my objective is to graph the four series m1, v1, beta1, theta1, which keeps giving me "unassigned" Your support is very much appreciated.
Thanks
Rachid
Hope all is well. I have difficulty with graphing the conditional moments, please see attached code along with the data. When I use the instruction TABLE to display the data, I see that e.g rho1 shows 0 number of observations while rho2 has 427, my objective is to graph the four series m1, v1, beta1, theta1, which keeps giving me "unassigned" Your support is very much appreciated.
Thanks
Rachid
- Attachments
-
- heterosc.xls
- (54.5 KiB) Downloaded 808 times
-
- Code_volatility_parametes_24.txt
- (2.2 KiB) Downloaded 1144 times
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Sorry, I attached the wrong code. The right code is attached, the data still the same
Thanks
Rachid
Thanks
Rachid
- Attachments
-
- Graph_Code_volatility_parametes_24.txt
- (4.9 KiB) Downloaded 1075 times
Re: Graph Condtional Moments
You're mixing up COMPUTEs and SETs. In
com a1 = (mux-m1)^2
com a2 = 2*(mux-m1)*((sigmaT1str)^(-1)*sigmaTx1str)*i1str
com a3 = 2*(mux-m1)*((sigmaT2str)^(-1)*sigmaTx2str)*i1strstr
com a4 = -((sigmaT1str)^(-2)*(sigmaTx1str^2)*i2str+(sigmaT2str)^(-2)*(sigmaTx2str^2)*i2strstr)
set a5 = -(d1-sigmaT1str^(-2)*(sigmaTx1str^2)*i0str)
set a6 = -(d2-(sigmaT2str^(-2))*(sigmaTx2str^2))*i0strstr
set v1 = c*(a1+a2+a3+a4+a5+a6)
those first four are all time-varying expressions, and so should be SET not COM. Similarly with the other batches of calculations.
com a1 = (mux-m1)^2
com a2 = 2*(mux-m1)*((sigmaT1str)^(-1)*sigmaTx1str)*i1str
com a3 = 2*(mux-m1)*((sigmaT2str)^(-1)*sigmaTx2str)*i1strstr
com a4 = -((sigmaT1str)^(-2)*(sigmaTx1str^2)*i2str+(sigmaT2str)^(-2)*(sigmaTx2str^2)*i2strstr)
set a5 = -(d1-sigmaT1str^(-2)*(sigmaTx1str^2)*i0str)
set a6 = -(d2-(sigmaT2str^(-2))*(sigmaTx2str^2))*i0strstr
set v1 = c*(a1+a2+a3+a4+a5+a6)
those first four are all time-varying expressions, and so should be SET not COM. Similarly with the other batches of calculations.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Thanks a lot Tom for your feedback, actually I was doing that at first but it gives me unassigned, just the syntax was incorrect, added more spacing, but I I still get unassigned at graph instruction of m1, v1, etc.., I have added (tem1=e), (tem2=d1), (temp3=d2) at each set instruction for m1, v1,..., which gives no error, but I don't get any graphs displaying. Also I don't understand why rho1 shows zero observations while rho2 shows 423 which is the correct number. your feedback is highly appreciated.
Thank you
Rachid
Thank you
Rachid
Re: Graph Condtional Moments
You have a typo setting up alpha10:
aplha10=0.204003
aplha10=0.204003
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Thanks a lot Tom, I don't know why I am getting sometimes one graph, sometimes none, I attached again the cleaned up code. Thank you so much
Rachid
Rachid
- Attachments
-
- Graph_Code_volatility_parametes_24.txt
- (4.91 KiB) Downloaded 1157 times
Re: Graph Condtional Moments
Use .5 rather 1/2 in your calculations. The latter is an integer divide, and is = 0.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Thanks a lot Tom. I am not getting all the graphs like it supposed to on one page, I get the graphs of m1 and v1 but not beta1 and theta1, I don't know why, and I would like to have them on one page, please advise. Thank you
Rachid
Rachid
Re: Graph Condtional Moments
What you have should produce a 2 x 2 matrix of graphs as soon as you get the calculations fixed. I don't see how you could get anything else.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Thanks a lot Tom, I would work on it again tomorrow and hopefully get it fixed, words cannot express really how much I appreciate your continuous support. Thank you again
Rachid
Rachid
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Graph Condtional Moments
Dear Tom,
Hope my email finds you well. I have attached two codes and the data file, one code is estimating the parameters I would need to graph my conditional moments using these estimates. It appears that convergence is good, however, the output for most graphs is fine with the exception of rho1 and rho2 which are the two correlation functions and therefore by construction should be between -1 and 1, but their graphs show otherwise, I scrutinized the estimation code very much, but I still don't see why I get this contradiction, could it be because the maximum I get is only local max. but logically speaking, it shouldn't, if you could look at my likelihood function and see if I need to add {} to my error function e please help. Thanks so much
Rachid
Hope my email finds you well. I have attached two codes and the data file, one code is estimating the parameters I would need to graph my conditional moments using these estimates. It appears that convergence is good, however, the output for most graphs is fine with the exception of rho1 and rho2 which are the two correlation functions and therefore by construction should be between -1 and 1, but their graphs show otherwise, I scrutinized the estimation code very much, but I still don't see why I get this contradiction, could it be because the maximum I get is only local max. but logically speaking, it shouldn't, if you could look at my likelihood function and see if I need to add {} to my error function e please help. Thanks so much
Rachid
- Attachments
-
- heterosc.xls
- (54.5 KiB) Downloaded 816 times
-
- Graph_Code_volatility.PRG
- (6.34 KiB) Downloaded 1188 times
-
- code_Volatility.PRG
- (3.05 KiB) Downloaded 1114 times
Re: Graph Condtional Moments
I don't see why you think rho1 and rho2 are correlations by construction---the numerator seems to have very little to do with the two standard deviations in the denominator.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Thanks Tom for your feedback. rho1=sigmaTx1/(sigmax1*sigmaTau1) by definition of correlation, If I understand your reply correctly, when you say the numerator and the denominator of rho1 e.g have a little in common, do you mean that the leverage effect gama31 is not related to leverage effects gama11 and gama21 for sigmax1 and sigmaTu1 , please also note that the covariance matrix is positive definite, kindly elaborate further on your earlier email. Thanks a lot
Rachid
Rachid
Re: Graph Condtional Moments
I'm saying that sigmaTX1 doesn't look like it's the covariance of the two terms whose variances are in the denominator---there are terms that don't match.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Thanks Tom. could you tell me e.g one term in the covariance that doesn't match. Maybe if I redefine s1 for example as,
s1 = beta10*lambda10+beta11*lambda11*(e{1}-gama11)*(e{1}-gama21)+beta12*lambda12*temp6{1}+(alpha11*alpha31)*f1{1}^2+(alpha12*alpha32)*f2{1}^2,
will s1 be matching now d1 and k1? Thank you
Rachid
s1 = beta10*lambda10+beta11*lambda11*(e{1}-gama11)*(e{1}-gama21)+beta12*lambda12*temp6{1}+(alpha11*alpha31)*f1{1}^2+(alpha12*alpha32)*f2{1}^2,
will s1 be matching now d1 and k1? Thank you
Rachid