ywh19860616 发表于 2012-1-3 19:50 
啊啊啊,我差点要崩溃了
可以了,非常感谢epoh老师
我是先 file\open\ywhtsp_lag2.tsp
老兄:
前半段在R package"systemfit",method: SUR
系数几乎与TSP完全相同
Wald test结果也相近
不过我用公式计算的结果
Wald test跟R相同.
底下结果先供你参考(lag1)
#####
eqwald=systemfit(eq,method="SUR")
systemfit results
method: SUR
Coefficients:
eq1_(Intercept) eq1_yx[, 2] eq1_yx[, 3]
-0.3116236 0.7912344 0.3156800
eq2_(Intercept) eq2_yx[, 5] eq2_yx[, 6]
-1.9283919 0.7911999 0.6604992
eq3_(Intercept) eq3_yx[, 8] eq3_yx[, 9]
4.2491434 0.4663545 -1.1681224
eq4_(Intercept) eq4_yx[, 11] eq4_yx[, 12]
2.3589350 0.9056093 -0.6801068
eq5_(Intercept) eq5_yx[, 17] eq5_yx[, 18]
-0.3052477 0.9767467 0.1238494
eq6_(Intercept) eq6_yx[, 20] eq6_yx[, 21]
2.3518272 0.7743578 -0.6510128
eq7_(Intercept) eq7_yx[, 23] eq7_yx[, 24]
1.6635026 0.7141601 -0.3865834
eq8_(Intercept) eq8_yx[, 29] eq8_yx[, 30]
-1.1089478 0.7368887 0.5098353
eq9_(Intercept) eq9_yx[, 35] eq9_yx[, 36]
-0.9212822 0.8625009 0.3588030
eq10_(Intercept) eq10_yx[, 38] eq10_yx[, 39]
-1.6699922 0.9390333 0.5252955
eq11_(Intercept) eq11_yx[, 41] eq11_yx[, 42]
2.6285152 0.6096717 -0.6554067
eq12_(Intercept) eq12_yx[, 44] eq12_yx[, 45]
0.6020769 0.7294215 -0.1217231
eq13_(Intercept) eq13_yx[, 47] eq13_yx[, 48]
2.0472847 0.8808392 -0.5324068
eq14_(Intercept) eq14_yx[, 50] eq14_yx[, 51]
-2.2657726 0.6590231 0.7412438
eq15_(Intercept) eq15_yx[, 53] eq15_yx[, 54]
-4.3419847 0.8962998 1.3894646
eq16_(Intercept) eq16_yx[, 56] eq16_yx[, 57]
2.0852281 0.7243596 -0.6305963
eq17_(Intercept) eq17_yx[, 59] eq17_yx[, 60]
1.3373892 0.5247059 -0.4812741
eq18_(Intercept) eq18_yx[, 62] eq18_yx[, 63]
2.4454699 0.5115543 -0.6443949
eq19_(Intercept) eq19_yx[, 68] eq19_yx[, 69]
0.3636687 0.7631305 -0.0839331
eq20_(Intercept) eq20_yx[, 71] eq20_yx[, 72]
-3.6582452 1.0674442 1.2167685
eq21_(Intercept) eq21_yx[, 74] eq21_yx[, 75]
0.3640366 0.9407530 -0.1071344
eq22_(Intercept) eq22_yx[, 77] eq22_yx[, 78]
-3.0892490 1.0079176 1.0312585
eq23_(Intercept) eq23_yx[, 83] eq23_yx[, 84]
-0.8411777 0.8838691 0.3719530
eq24_(Intercept) eq24_yx[, 86] eq24_yx[, 87]
-0.4724494 0.7554644 0.2264534
> #Wald test
> Rmat <- matrix(0, nrow = 24, ncol = 72)
> for(i in 1:24){
+ Rmat[i,(3*i)]=1
+ print(linearHypothesis( eqwald, Rmat[i,], test = "Chisq" ))
+ }
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eqyx[, 3] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.3689 0.5436
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq2_yx[, 6] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 3.4862 0.06188 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq3_yx[, 9] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 7.4933 0.006193 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq4_yx[, 12] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 1.4515 0.2283
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq5_yx[, 18] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.2375 0.626
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq6_yx[, 20
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.8304 0.3621
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq7_yx[, 24] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.5466 0.4597
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq8_yx[, 30] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.2118 0.6454
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq9_yx[, 36] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 2.2131 0.1368
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq10_yx[, 39] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 9.2704 0.002329 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq1yx[, 42] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 1.6489 0.1991
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq12_yx[, 45] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.0428 0.8362
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq13_yx[, 48] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 4.8809 0.02716 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq14_yx[, 50
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.8869 0.3463
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq15_yx[, 54] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 3.7559 0.05262 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq16_yx[, 57] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 2.6813 0.1015
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq17_yx[, 60] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 5.1157 0.02371 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq18_yx[, 63] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 15.399 8.705e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq19_yx[, 69] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.1866 0.6657
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq20_yx[, 72] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 1.6842 0.1944
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq2yx[, 75] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.1678 0.6821
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq22_yx[, 78] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 7.738 0.005407 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq23_yx[, 84] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.1639 0.6856
Linear hypothesis test (Chi^2 statistic of a Wald test)
Hypothesis:
eq24_yx[, 87] = 0
Model 1: restricted model
Model 2: eqwald
Res.Df Df Chisq Pr(>Chisq)
1 817
2 816 1 0.3989 0.5277