Page 1 of 1

Exporting R-SQU to Excel

Posted: Tue Nov 14, 2017 9:28 am
by BCNAV
I am running a batch of ARIMAs:

Code: Select all

genr tot_ecu_hf=0
group a_results
for %series {%vars}
   smpl @first %history_end_date
   freeze(mode=overwrite,{%series}_stats) {%series}.autoarma(tform=auto,diff=2,select=aic,periods=12,kpsssig=5,eqname={%series}_eq,maxar=4,maxma=3,maxsar=1,maxsma=1,seed=131071,forclen={!fcst_length},etable,agraph,atable,fgraph) forecast
   
   'Tidy up variable names so that they are named properly and all data stored where you want, could have done {%series}_f above instead of forecast, but below permits custom variable names and content
   smpl %forecast_start_date %forecast_end_date
      genr {%series}_f=forecast
   smpl @all
      genr {%series}_hf={%series}
   smpl %forecast_start_date %forecast_end_date
      {%series}_hf={%series}_f

   group a_results a_results {%series}_hf

   smpl @all
      tot_ecu_hf=tot_ecu_hf+{%series}_hf
   smpl @first %history_end_date

next
delete forecast
smpl @all
group a_results a_results tot_ecu_hf


I need to be able to export the r-square from each model to Excel, which will be linked to another Excel later. Any ideas on the best way to do this? Perhaps a table? Or direct export?

thanks

Re: Exporting R-SQU to Excel

Posted: Tue Nov 14, 2017 9:29 am
by EViews Gareth
Store them into a matrix, then save the matrix as a xls

Re: Exporting R-SQU to Excel

Posted: Tue Nov 14, 2017 10:35 am
by BCNAV
Thanks...I had tried a table, but EViews still cannot export an excel table. Only CSV, and CSV won't work for linking to another XLS. Any reason why this has not been added to EViews?

In any case, how would the matrix work? I tried:

Code: Select all

matrix a_rsq2
!rowcount=1
for %series {%vars}
   smpl @first %history_end_date
   freeze(mode=overwrite,{%series}_stats) {%series}.autoarma(tform=auto,diff=2,select=aic,periods=12,kpsssig=5,eqname={%series}_eq,maxar=4,maxma=3,maxsar=1,maxsma=1,seed=131071,forclen={!fcst_length},etable,agraph,atable,fgraph) forecast
   
   'Tidy up variable names so that they are named properly and all data stored where you want, could have done {%series}_f above instead of forecast, but below permits custom variable names and content
   smpl %forecast_start_date %forecast_end_date
      genr {%series}_f=forecast
   smpl @all
      genr {%series}_hf={%series}
   smpl %forecast_start_date %forecast_end_date
      {%series}_hf={%series}_f

   group a_results a_results {%series}_hf

   smpl @all
      tot_ecu_hf=tot_ecu_hf+{%series}_hf
   smpl @first %history_end_date


   'Populate table of Variable Name & R-Squareds
   a_rsq({!rowcount},1)={%series}.@displayname
   a_rsq({!rowcount},2)={%series}_eq.@r2

   'Populate maxtrix of R-Squareds Only for Export to Excel
   a_rsq2({!rowcount},1)={%series}_eq.@r2
   !rowcount=!rowcount+1
next


I get an error saying 2,1 is not valid for a matrix.

thanks

Re: Exporting R-SQU to Excel

Posted: Tue Nov 14, 2017 10:51 am
by EViews Gareth
You have to size the matrix when you create it.