全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 EViews专版
1309 1
2010-09-03
1。我要用从1973q1到1990q4的数据来回归通货膨胀(inf)在利息(inl(-1))上,要预测1991q1,但inffit里好像是对整个workfile时间段的预测,请问这是为什么?


' set sample to estimation period
smpl 1973q1 1990q4

   ' estimate equation
equation eq1.ls inf c inl(-1)

   'generate  fited value
smpl 1991q1 1991q4
eq1.fit inffit


还有个问题: 我用inl和inf的lags来预测inf,用AIC来选lags,做one-step-ahead预测,
'Program that calculates the "best" ARMA specification for an equation.  Edit the variables below to match your particular data/setup.

    %eqname = "EQ01"   'name of equation object that will be used.
    %maxINF= "4"            'maximum number of AR terms
    %maxX = "4"   'maximum number of MA terms
    %dep = "INF"   'dependent variable
    %regs = "INL"   'independent variables
    %criterion = "@AIC"    'which criterion to use  enter "@AIC" for Akaike, "@schwarz" for Schwarz, and @HQ for Hannan-Quinn

    !maxINF = @val(%maxINF)
    !maxX = @val(%maxX)


    close {%eqname}



    !mincrit = 10000  'set the minimum to an artificially large value to begin

    'estimate the models
    %infstring = ""
    for !i=0 to !maxINF
       'build up string for AR terms.
       if !i>0 then
          %infstring = %infstring + " inf(-" + @str(!i) + ")"
       endif
       %xstring = "inl(-1)"
       for !j=1 to !maxX
          'build up string for indicator
          if !j>1 then
             %xstring = %xstring + " inl(-" + @str(!j) + ")"
          endif
          'estimate equation
          equation {%eqname}.ls {%dep} c {%infstring} {%xstring}
          'capture criterion
          if @upper(%criterion) = "@AIC" then
             !crit = {%eqname}.@aic
          endif
          if @upper(%criterion) = "@SCHWARZ" then
             !crit = {%eqname}.@schwarz
          endif
          if @upper(%criterion) = "@HQ" then
             !crit = {%eqname}.@hq
          endif
          'compare criterion
          if !crit < !mincrit then
             !mincrit = !crit
             !bestINF = !i
             !bestX = !j
             %bestINFstr = %infstring   'store the best ar string
             %bestXstr = %xstring   'store the best ma string
             {%matname}.settextcolor(@all) black   'table formatting.
             !ii=!i+2
             !jj=!j+2
             {%matname}.settextcolor(!ii,!jj) red
          endif
          {%matname}(!i+2,!j+2) = !crit
          {%matname}(!i+2,1) = !i
          {%matname}(1,!j+2) = !j
       next
    next

    equation {%eqname}.ls {%dep} c {%bestINFstr} {%bestXstr}


    equation {%eqname}.ls {%dep} c {%bestINFstr} {%bestXstr}是对一个特殊的时间段最好的模型

2。然后我要对每个时间段1973q1-1990q4,1973q1-1991q1,1973q1-1991q...做one-step-ahead预测,把最好的模型代到下边的程序



' get size of workfile
!length = @obsrange

' declare equation for estimation
equation eq1

    'create table for storing critical values.
    %matname = "forecast_errors"
    table(!length-40,1) {%matname}

' move sample 1 step obs at a time
for !s = 0  to  !length-40-1

   ' set sample to estimation period
   smpl @first @first+40+!s

   ' estimate equation
    equation eq1.ls inf c inl(-1)

   'calculate fited value
   smpl @first+40+!s+1 @first+40+!s+1
     eq1.fit inffit

   'store fited value
    {%matname}(!s,1)=@mean(inffit)
next

show  {%matname}

请问怎么把equation eq1.ls inf c inl(-1)换成AIC选的模型equation {%eqname}.ls {%dep} c {%bestINFstr} {%bestXstr}?


3。另外我如果要用inf里1991q1的数值,用什么指令把它提取出来?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-12-21 10:48:29
你可以对样本区间进行设定
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群