Graph Condtional Moments
Re: Graph Condtional Moments
The second and third terms. With the "temp" variables being zero, the third washes, so it was the 2nd terms that didn't match. Your fix takes care of the second term, but you probably want to fix the third as well in case you ever use a non-zero set of "temp" series.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Thanks so much Tom.
Does this looks reasonable now s1 = beta10*lambda10+beta11*lambda11*(e{1}-gama11)*(e{1}-gama21)+beta12*lambda12*temp2{1}*temp4{1}+(alpha11*alpha31)*f1{1}^2+(alpha12*alpha32)*f2{1}^2,
Very much appreciated
Rachid
Does this looks reasonable now s1 = beta10*lambda10+beta11*lambda11*(e{1}-gama11)*(e{1}-gama21)+beta12*lambda12*temp2{1}*temp4{1}+(alpha11*alpha31)*f1{1}^2+(alpha12*alpha32)*f2{1}^2,
Very much appreciated
Rachid
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Sorry I meant sqrt in both temp2 and temp4.
Thanks again
Rachid
Thanks again
Rachid
Re: Graph Condtional Moments
That looks correct. Note, BTW, that you're asking us to check your algebra, not your RATS program, which is really outside the scope of what we should be doing.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Sorry about that.
Thanks
Thanks
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Dear Tom,
Hope all is well. Regarding the two attached codes in my previous email (code for parameter estimation and graphs of conditional moments) is there a way to combine both codes in one so that I don't have to each time do copy and paste of the parameters I get from the first code into the graph code. Thanks
Rachid
Hope all is well. Regarding the two attached codes in my previous email (code for parameter estimation and graphs of conditional moments) is there a way to combine both codes in one so that I don't have to each time do copy and paste of the parameters I get from the first code into the graph code. Thanks
Rachid
Re: Graph Condtional Moments
Of course. What you did is harder than combining them.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Thanks for your prompt reply, well how is it done then? Are there e.g internal name variables for these parameters, and if so how are they defined, I am willing to find out myself how it is done, if you could direct me to the RATS user guide for an example. Thanks for your support
Rachid
Rachid
Re: Graph Condtional Moments
Just take the part of your graphing program that does the graphs given the parameters, and add it to the end of the estimation program. One copy and paste, one time. Done.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Thanks Tom, i get the point. Very much appreciated
Rachid
Rachid
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Dear Tom,
I don't really know what I am doing wrong here, but I did exactly what you suggested on your last email, when I run the codes separately I get nice graphs, when I join them I get rubbish or an error by "set e". I attached the joined codes. Please help
Thanks
Rachid
I don't really know what I am doing wrong here, but I did exactly what you suggested on your last email, when I run the codes separately I get nice graphs, when I join them I get rubbish or an error by "set e". I attached the joined codes. Please help
Thanks
Rachid
- Attachments
-
- joined_Code_.txt
- (10.75 KiB) Downloaded 1407 times
Re: Graph Condtional Moments
In the first part, you have the following definitions as FRML's so you can estimate:
frml e = x-a10-a11*x{1}-a12*temp1{1}
frml mux = a10+a11*x{1}+a12*e{1}
frml muT = a20+a21*f1{1}+a22*f2{1}
frml d1 = beta10^2+(beta11^2)*(e{1}-gama11)^2+(beta12^2)*temp2{1}+(alpha11^2)*f1{1}^2+(alpha12^2)*f2{1}^2
frml d2 = beta20^2+(beta21^2)*(e{1}-gama12)^2+(beta22^2)*temp3{1}+(alpha21^2)*f1{1}^2+(alpha22^2)*f2{1}^2
frml k1 = lambda10^2+(lambda11^2)*(e{1}-gama21)^2+(lambda12^2)*temp4{1}+(alpha31^2)*f1{1}^2+(alpha32)^2*f2{1}^2
frml k2 = lambda20^2+(lambda21^2)*(e{1}-gama22)^2+(lambda22^2)*temp5{1}+(alpha41^2)*f1{1}^2+(alpha42^2)*f2{1}^2
frml sigmaTx1 = (beta10*lambda10)+(beta11*lambda11)*(e{1}-gama11)*(e{1}-gama21)+(beta12*lambda12)*temp6{1}+(alpha11*alpha31)*f1{1}^2+(alpha12*alpha32)*f2{1}^2
frml sigmaTx2 = (beta20*lambda20)+(beta21*lambda21)*(e{1}-gama12)*(e{1}-gama22)+(beta22*lambda22)*temp7{1}+(alpha21*alpha41)*f1{1}^2+(alpha22*alpha42)*f2{1}^2
You're then trying to re-define them as SERIES in the second half. You don't need to do that. Just get rid of the SET's for all the series covered by that set of FRML's.
frml e = x-a10-a11*x{1}-a12*temp1{1}
frml mux = a10+a11*x{1}+a12*e{1}
frml muT = a20+a21*f1{1}+a22*f2{1}
frml d1 = beta10^2+(beta11^2)*(e{1}-gama11)^2+(beta12^2)*temp2{1}+(alpha11^2)*f1{1}^2+(alpha12^2)*f2{1}^2
frml d2 = beta20^2+(beta21^2)*(e{1}-gama12)^2+(beta22^2)*temp3{1}+(alpha21^2)*f1{1}^2+(alpha22^2)*f2{1}^2
frml k1 = lambda10^2+(lambda11^2)*(e{1}-gama21)^2+(lambda12^2)*temp4{1}+(alpha31^2)*f1{1}^2+(alpha32)^2*f2{1}^2
frml k2 = lambda20^2+(lambda21^2)*(e{1}-gama22)^2+(lambda22^2)*temp5{1}+(alpha41^2)*f1{1}^2+(alpha42^2)*f2{1}^2
frml sigmaTx1 = (beta10*lambda10)+(beta11*lambda11)*(e{1}-gama11)*(e{1}-gama21)+(beta12*lambda12)*temp6{1}+(alpha11*alpha31)*f1{1}^2+(alpha12*alpha32)*f2{1}^2
frml sigmaTx2 = (beta20*lambda20)+(beta21*lambda21)*(e{1}-gama12)*(e{1}-gama22)+(beta22*lambda22)*temp7{1}+(alpha21*alpha41)*f1{1}^2+(alpha22*alpha42)*f2{1}^2
You're then trying to re-define them as SERIES in the second half. You don't need to do that. Just get rid of the SET's for all the series covered by that set of FRML's.
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Dear Tom,
Thanks a lot for your continuous support. I have a cleaned up the code, please see the attached edited "joined code_1", however, when I run this code I still get rubbish graphs as opposed to good graphs when run separately. I used the "print instruction" to scrutinize my output, and I see that in the joined code many data points are either NA or incorrectly calculated, but for the two separate codes I get good values. Please advise.
Thank you
Rachid
Thanks a lot for your continuous support. I have a cleaned up the code, please see the attached edited "joined code_1", however, when I run this code I still get rubbish graphs as opposed to good graphs when run separately. I used the "print instruction" to scrutinize my output, and I see that in the joined code many data points are either NA or incorrectly calculated, but for the two separate codes I get good values. Please advise.
Thank you
Rachid
- Attachments
-
- joined_Code_1.txt
- (9.75 KiB) Downloaded 1452 times
-
rbelhach95
- Posts: 115
- Joined: Sat Feb 09, 2013 9:30 am
Re: Graph Condtional Moments
Please see the 2 attached graphs mentioned in my last email
Thanks
Rachid
Thanks
Rachid
- Attachments
-
- Graph_2.RGF
- (25.95 KiB) Downloaded 1453 times
-
- Graph_1.RGF
- (27.97 KiB) Downloaded 1397 times
Re: Graph Condtional Moments
Isn't this a different model? Perhaps you are getting bad graphs because you're getting bad estimates. These don't look usable to me. Among other things, it's a very bad idea to use lambda21=0 as a guess value for (lambda21^2)*(e{1}-gama22)^2 because gama22 isn't identified at the guess values and the derivative with respect to lambda21 is zero.rbelhach95 wrote:Dear Tom,
Thanks a lot for your continuous support. I have a cleaned up the code, please see the attached edited "joined code_1", however, when I run this code I still get rubbish graphs as opposed to good graphs when run separately. I used the "print instruction" to scrutinize my output, and I see that in the joined code many data points are either NA or incorrectly calculated, but for the two separate codes I get good values. Please advise.
Thank you
Rachid
Code: Select all
MAXIMIZE - Estimation by BFGS
NO CONVERGENCE IN 114 ITERATIONS
LAST CRITERION WAS 0.0000000
ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK
Monthly Data From 1978:12 To 2013:09
Usable Observations 413
Skipped/Missing (from 418) 5
Function Value NA
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. A10 1.0473178 0.2253669 4.64717 0.00000337
2. A11 -0.4866274 0.0785399 -6.19593 0.00000000
3. A12 0.5360456 0.0797345 6.72288 0.00000000
4. A20 1.5161977 1.2180825 1.24474 0.21322681
5. A21 -4.4407812 1.2286561 -3.61434 0.00030111
6. A22 0.2974692 0.0092911 32.01654 0.00000000
7. BETA10 -0.0415601 0.5524054 -0.07523 0.94002793
8. BETA11 0.2634283 0.0657946 4.00380 0.00006233
9. BETA12 0.9224623 0.0210704 43.78003 0.00000000
10. BETA20 -0.2974384 0.3603854 -0.82533 0.40918184
11. BETA21 0.4491172 0.0576414 7.79158 0.00000000
12. BETA22 -0.3750155 0.1160372 -3.23186 0.00122989
13. LAMBDA10 0.2063586 0.0745827 2.76684 0.00566021
14. LAMBDA11 2.8929021 0.6782412 4.26530 0.00001996
15. LAMBDA12 -2.3274169 0.4034412 -5.76891 0.00000001
16. LAMBDA20 -0.3384745 0.8577936 -0.39459 0.69314746
17. LAMBDA21 0.0009211 0.0024188 0.38079 0.70335944
18. LAMBDA22 0.4618360 0.1967321 2.34754 0.01889797
19. ALPHA11 0.4083553 0.4547312 0.89801 0.36917773
20. ALPHA12 -0.0052590 0.0038077 -1.38116 0.16723030
21. ALPHA21 -1.6911879 0.4783948 -3.53513 0.00040757
22. ALPHA22 -0.0246184 0.0040149 -6.13169 0.00000000
23. ALPHA31 0.8256964 0.4329012 1.90736 0.05647458
24. ALPHA32 0.0624921 0.0032536 19.20685 0.00000000
25. ALPHA41 -1.9729743 0.9038829 -2.18278 0.02905229
26. ALPHA42 0.0021609 0.0098981 0.21832 0.82718236
27. GAMA11 1.1373636 1.1658485 0.97557 0.32927901
28. GAMA12 7.2798033 0.9785560 7.43933 0.00000000
29. GAMA21 -297.9302882 70.0962469 -4.25030 0.00002135
30. GAMA22 -329.2616947 127.3408296 -2.58567 0.00971892