==DATA_VIEW Display and Analyse Data b34sexec matrix; /$ /$ Version 27 September 2001 /$ /$ Program asks user to select a loaded series /$ for further analysis. Options to enter Manual Mode /$ are also provided /$ call echooff; call loaddata; call load(data_acf); call load(do_spec); call load(dataview); call load(get_name); back continue; i3=1; call menu(i3 :menutype menuvert :text 'Proceed to Select Series' :text 'Enter Manual Mode' :text 'Stop ' :heading 'Process Control' ); if(i3.eq.3)go to done; if(i3.eq.2)then; call manual; go to back; endif; if(i3.eq.1)then; call get_name(cc,ii); if(ii.eq.0)go to back; /$ Place the supplied name in a character*1 array call character(nn,cc); call dataview(eval(cc),nn); go to back; endif; done continue; b34srun; == ==DRAW Preliminary Draw Program b34sexec matrix; call graphp(:start ); call graphp(:cont :grarea array(:0. 0. 1. 1.) :grunits array(:0. 0. 1. 1.) :color red :toolbox ); call graphp(:final); b34srun; == ==FORM_INFO Load Form into forms display /$ Loads an existing form into forms b34sexec matrix; call get_file(cc); * call menu(cc :menutype inputtext :prompt 'Input *.ifd name=>' ); call forms(:start :formload cc S); call forms(:cont :forminfolist); call names(all); call print('# of Fields ',nfield_1:); call print('# of Boxes ',nbox_1 :); call print('# of Tabs ',ntab_1 :); call tabulate(ifx_1,ify_1,ifwid_1,iftype_1,ifiden_1 :rjname); b34srun; == ==CCF_STUDY Effect of Autocorrelation on CCF b34sexec matrix; call echooff; call load(ccftest); call load(acf_plot); nccf=30; nlag=3; nccf=30; n=100; r8=.1; noise=1.; coef=1.; subroutine getdat(n,nccf,nlag,r8,noise,coef,nlag,igo); nfields=16; ioff=3; /$ type codes string 1 integer 2 real 3 cycling 4 /$ push 5 double 6 vert 7 long string 8 /$ check 9 check discript 10 idfield=integers(nfields); icol =index( 20 20 4 60 4 60 4 60 4 60 4 60 4 60 6 60 ); irow =index( 1 2 4 4 6 6 8 8 10 10 12 12 14 14 18 18) + ioff; iwidth=index( 40 40 40 8 40 3 40 16 40 16 40 16 40 2 10 10); itype =index( 1001 1001 1001 2 1001 2 1001 6 1001 6 1001 6 1001 2 5 5); idbox =index(1); icolbox=index( 3); irowbox=index(17+ioff); iwbox =index(68); ihbox =index(3); call character(fmt,'(g16.8)'); call forms(:start :formdefine S idfield icol irow iwidth itype :formhelp index(2 21+ioff 68) :formdefinebox idbox icolbox irowbox iwbox ihbox :commandn 'CCF and ACF Relationships' ); call forms(:cont :formputstring 1 'Study effects of ACF on CCF' :formputstring 2 'Adjust Parameters and Run Form' :formputstring 3 'Input # of observations' :formputstring 5 'Input # of terms in CCF' :formputstring 7 'Input ar(1) in range -.999 - .999' :formputstring 9 'Input noise multiplier' :formputstring 11 'Input Coef multiplier' :formputstring 13 'Input lag' :formputinteger 4 n :formrangeinteger 4 index( 10 999999999) :formputinteger 6 nccf :formrangeinteger 6 index(2 999) :formputdouble 8 r8 fmt :formrangedouble 8 array(:-1., 1.) :formputdouble 10 noise fmt :formrangedouble 10 array(:0.0 100.) :formputdouble 12 coef fmt :formputinteger 14 nlag :formrangeinteger 14 index(0 30) :formputbutton 15 'Run' 21 :formputbutton 16 'Escape' 23 :formattribute 1 'N' 'bblue' ' ' :formattribute 2 'N' 'bblue' ' ' :formattribute 15 'N' 'byellow' ' ' :formattribute 16 'N' 'bred' ' ' :formputhelp 4 'Enter an integer*4 GT 10 here' :formputhelp 6 'Enter an integer*4 here' :formputhelp 8 'Enter an real*8 here' :formputhelp 10 'Enter an real*8 here' :formputhelp 12 'Enter an real*8 here' :formputhelp 14 'Enter an integer*4 in range 0-30 here' :formputhelp 15 'Run the Menu' :formputhelp 16 'Escape without running' :formshowedit ii /$ :forminfolist :formgetinteger 4 n :formgetinteger 6 nccf :formgetdouble 8 r8 :formgetdouble 10 noise :formgetdouble 12 coef :formgetinteger 14 nlag ); call forms(:final); igo=0; if(ii.eq.21)igo=1; if(ii.eq.23)igo=0; return; end; again continue; call free(ma); call getdat(n,nccf,nlag,r8,noise,coef,nlag,igo); call cls; if(igo.eq.0)go to done; /$ /$ This is the older and easier menu approach /$ call menu(n :menutype inputint /$ :prompt '# of cases of for CCF example' /$ ); /$ call menu(nccf :menutype inputint /$ :prompt '# of ccf to calculate' /$ ); /$call menu(nlag :menutype inputint /$ :prompt 'Enter lag as a positive number' /$ ); /$ call menu(r8 :menutype inputreal8 /$ :prompt 'Enter ar(1) parameters in range -.999 - .999' /$ ); /$call menu(noise :menutype inputreal8 /$ :prompt 'Noise. Usual setting 1.0' /$ ); /$ /$call menu(coef :menutype inputreal8 /$ :prompt 'Input Coef. Usual setting 1.0' /$ ); /$ ar=array(: r8); nn=100; start=array(:.1); x=genarma(ar,ma,1.0,start,.1,n,nn); i=integers(nlag+1,norows(x)); y=array(norows(x):)+missing(); rr=noise*rn(x); y(i)= coef*x(i-nlag)+rr(i); if(nlag.gt.0)then; do ii=1,nlag; x(ii)=missing(); y(ii)=missing(); enddo; endif; x=goodrow(x); y=goodrow(y); call character(title,'Effect of Autocorrelation on cross correlations'); /$ call tabulate(x,y); call acf_plot(x,nccf,'X Series'); call acf_plot(y,nccf,'Y Series'); call ccftest(x,y,nccf,lags,title); j=2; call menu(j :menutype menutwo :heading 'Continue selection' :text 'stop' :text 'go' :prompt 'Continue?' ); if(j.eq.2)go to again; done continue; b34srun; == ==OLS_MARS 3-D OLS/MARS Lags b34sexec matrix; /$ /$ Version 27 May 2002 /$ /$ Program asks user to select a loaded series /$ for further analysis. Options to enter Manual Mode /$ are also provided /$ subroutine getdat(nylag,nxlag,nsubset,nk,mi,printmod,printrss,igo); nfields=18; ioff=3; /$ type codes string 1 integer 2 real 3 cycling 4 /$ push 5 double 6 vert 7 long string 8 /$ check 9 check discript 10 idfield=integers(nfields); icol =index( 20 20 4 60 4 60 4 60 4 60 4 60 4 60 4 60 6 60); irow =index( 1 2 4 4 6 6 8 8 10 10 12 12 14 14 16 16 18 18) + ioff; iwidth=index( 40 40 40 2 40 2 40 2 40 2 40 2 40 1 40 1 10 10); itype =index( 1001 1001 1001 2 1001 2 1001 2 1001 2 1001 2 1001 2 1001 2 5 5); idbox =index(1); icolbox=index( 3); irowbox=index(17+ioff); iwbox =index(68); ihbox =index(3); call character(fmt,'(g16.8)'); call forms(:start :formdefine S idfield icol irow iwidth itype :formhelp index(2 21+ioff 68) :formdefinebox idbox icolbox irowbox iwbox ihbox :commandn 'CCF and ACF Relationships' ); call forms(:cont :formputstring 1 'Study effects of Lags on RSS' :formputstring 2 'Adjust Parameters and Run Form' :formputstring 3 'Input # of Y lags' :formputstring 5 'Input # of X lags' :formputstring 7 'Input # of First Subset lag' :formputstring 9 'Input NK > 0 for MARS model' :formputstring 11 'Enter MI value for MARS' :formputstring 13 'Enter 1 to print basic model' :formputstring 15 'Enter 1 to print RSS' :formputinteger 4 nylag :formrangeinteger 4 index(1 99) :formputinteger 6 nxlag :formrangeinteger 6 index(1 99) :formputinteger 8 nsubset :formrangeinteger 8 index(1 99) :formputinteger 10 nk :formrangeinteger 10 index(0 99) :formputinteger 12 mi :formrangeinteger 12 index(1 4) :formputinteger 14 printmod :formrangeinteger 14 index(0 1) :formputinteger 16 printrss :formrangeinteger 16 index(0 1) :formputbutton 17 'Run' 21 :formputbutton 18 'Escape' 23 :formattribute 1 'N' 'bblue' ' ' :formattribute 2 'N' 'bblue' ' ' :formattribute 17 'N' 'byellow' ' ' :formattribute 18 'N' 'bred' ' ' :formputhelp 4 'Enter an integer*4 GT 0 here' :formputhelp 6 'Enter an integer*4 GT 0 here' :formputhelp 8 'Enter an integer*4 GT 0 here' :formputhelp 10 'Set NK GE 1 for MARS Model' :formputhelp 17 'Run the Menu' :formputhelp 18 'Escape without running' :formshowedit ii /$ :forminfolist :formgetinteger 4 nylag :formgetinteger 6 nxlag :formgetinteger 8 nsubset :formgetinteger 10 nk :formgetinteger 12 mi :formgetinteger 14 printmod :formgetinteger 16 printrss ); call forms(:final); igo=0; if(ii.eq.21)igo=1; if(ii.eq.23)igo=0; return; end; call echooff; call loaddata; call load(lagtest ); call load(lagtest2); call load(get_name); call load(data_acf); call load(do_spec); call load(dataview); nylag =6; nxlag =6; nsubset =5; nk=0; mi=1; printmod=0; printrss=0; back continue; i3=1; call menu(i3 :menutype menuvert :text 'Proceed to Select Y Series' :text 'Proceed to Select X Series' :text 'Proceed to Setup Lags' :text 'Display Lags' :text 'Enter Manual Mode' :text 'Data View ' :text 'Stop ' :heading 'Process Control' ); if(i3.eq.1)then; call get_name(ccy,ii); if(ii.eq.0)go to back; call character(nn1,ccy); go to back; endif; if(i3.eq.2)then; call get_name(ccx,ii); if(ii.eq.0)go to back; call character(nn2,ccx); go to back; endif; if(i3.eq.3)then; call getdat(nylag,nxlag,nsubset,nk,mi,printmod,printrss,igo); if(igo.eq.0)go to done; go to back; endif; if(i3.eq.4)then; x=eval(ccx); y=eval(ccy); if(nk.eq.0)then; if(printmod.ne.0)call olsq(y y{1 to nylag} x{1 to nxlag} :print); call lagtest(eval(ccy),eval(ccx),nylag,nxlag,nsubset,rss); if(printrss.ne.0)call print('RSS From OLS Model',rss); endif; if(nk.ne.0)then; if(printmod.ne.0)call mars(y y{1 to nylag} x{1 to nxlag} :print :mi mi :nk nk); call lagtest2(eval(ccy),eval(ccx),nylag,nxlag,nsubset,mi,nk,rss); if(printrss.ne.0)call print('RSS From MARS Model',rss); endif; go to back; endif; if(i3.eq.5)then; call manual; go to back; endif; if(i3.eq.6)then; call get_name(cc,ii); if(ii.eq.0)go to back; /$ Place the supplied name in a character*1 array call character(nn,cc); call dataview(eval(cc),nn); go to back; endif; if(i3.eq.7)go to done; done continue; b34srun; ==