全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
938 0
2017-04-05
运行 sas support里的Example 19.6 The Cigarette Sales Data: Dynamic Panel Estimation with GMM

data cigar;
       input state year price pop pop_16 cpi ndi sales pimin;
       label
       state  = 'State abbreviation'
       year   = 'YEAR'
       price  = 'Price per pack of cigarettes'
       pop    = 'Population'
       pop_16 = 'Population above the age of 16'
       cpi    = 'Consumer price index with (1983=100)'
       ndi    = 'Per capita disposable income'
       sales  = 'Cigarette sales in packs per capita'
       pimin  = 'Minimum price in adjoining states per pack of cigarettes';
       datalines;
   1 63 28.6 3383 2236.5 30.6 1558.3045298 93.9 26.1
   1 64 29.8 3431 2276.7 31.0 1684.0732025 95.4 27.5
   1 65 29.8 3486 2327.5 31.5 1809.8418752 98.5 28.9
   1 66 31.5 3524 2369.7 32.4 1915.1603572 96.4 29.5
   1 67 31.6 3533 2393.7 33.4 2023.5463678 95.5 29.6
   1 68 35.6 3522 2405.2 34.8 2202.4855362 88.4 32
   1 69 36.6 3531 2411.9 36.7 2377.3346665 90.1 32.8
   1 70 39.6 3444 2394.6 38.8 2591.0391591 89.8 34.3
   1 71 42.7 3481 2443.5 40.5 2785.3159706 95.4 35.8
   
   ... more lines ...   



The following statements sort the data by STATE and YEAR variables.

    proc sort data=cigar;
       by state year;
    run;


Next, logarithms of the variables required for regression estimation are calculated, as shown in the following statements:

    data cigar;
       set cigar;
       lsales = log(sales);
       lprice = log(price);
       lndi = log(ndi);
       lpimin = log(pimin);
       label lprice = 'Log price per pack of cigarettes';
       label lndi = 'Log per capita disposable income';
       label lsales = 'Log cigarette sales in packs per capita';
       label lpimin = 'Log minimum price in adjoining states
                        per pack of cigarettes';
    run;


The following statements create the CIGAR_LAG data set with lagged variable for each cross section.

    proc panel data=cigar;
        id state year;
        clag lsales(1) / out=cigar_lag;
    run;


    data cigar_lag;
        set cigar_lag;
        label lsales_1 = 'Lagged log cigarette sales in packs per capita';
    run;


Finally, the model is estimated by a two step GMM method. Five lags (MAXBAND=5) of the dependent variable are used as instruments. NOLEVELS options is specified to avoid use of level equations, as shown in the following statements:

    proc panel data=cigar_lag;
        inst depvar;
        model lsales = lsales_1 lprice lndi lpimin
            / gmm nolevels twostep maxband=5;
        id state year;
    run;

我得出的结果
第一阶段:
因变量: lsales Log cigarette sales in packs per capita

模型说明
估计方法 GMM1
截面数 46
时间序列长度 30
估计阶段 1
最大时间期间数 (MAXBAND) 5



拟合统计量
SSE 2196.8593 DFE 1284
MSE 1.7109 均方根误差 1.3080



Sargan 检验
自由度 统计量 Prob > 卡方
125 29.18 1.0000



参数估计
变量 自由度 估计 标准
误差 t 值 Pr > |t|
lsales_1 1 0.571572 0.1779 3.21 0.0013
lprice 1 -0.23945 0.3776 -0.63 0.5261
lndi 1 0.232758 0.0928 2.51 0.0122
lpimin 1 -0.07817 0.3198 -0.24 0.8069



AR(m) 检验
滞后 统计量 Pr > 统计量
1 -0.52 0.6988

第二阶段:
模型说明
估计方法 GMM2
截面数 46
时间序列长度 30
估计阶段 2
最大时间期间数 (MAXBAND) 5



拟合统计量
SSE 2187.5988 DFE 1284
MSE 1.7037 均方根误差 1.3053



Sargan 检验
自由度 统计量 Prob > 卡方
125 2111.56 <.0001



参数估计
变量 自由度 估计 标准
误差 t 值 Pr > |t|
lsales_1 1 0.572219 0.000981 583.51 <.0001
lprice 1 -0.23464 0.00306 -76.56 <.0001
lndi 1 0.232673 0.000392 593.69 <.0001
lpimin 1 -0.08299 0.00328 -25.29 <.0001



AR(m) 检验
滞后 统计量 Pr > 统计量
1 -5.17 1.0000


sargan值第一阶段为1,第二阶段为0,怎么调整。没找到sas中gmm的hansen值在哪里?




二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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