楼主: kanonathena
1196 1

[资料] 问一些问题关于预测 [推广有奖]

  • 0关注
  • 0粉丝

学前班

90%

还不是VIP/贵宾

-

威望
0
论坛币
2 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
63 点
帖子
2
精华
0
在线时间
4 小时
注册时间
2009-5-30
最后登录
2016-6-2

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
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的数值,用什么指令把它提取出来?
二维码

扫码加我 拉你入群

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

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

关键词:Independent Estimation particular Artificial formatting equation generate period 时间段

沙发
ermutuxia 发表于 2012-12-21 10:48:29 |只看作者 |坛友微信交流群
你可以对样本区间进行设定

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-26 03:07