R代码,用于测试一个面板回归的回归系数之间的差异

R code to test the difference between coefficients of regressors from one panel regression

我正在尝试比较两个 来自两个不同时间段的同一面板回归的系数,以确认差异的统计显着性。因此,运行 我的面板回归首先使用 2007-2009 年的观察结果,我得到了一个我感兴趣的系数的估计值,以便与从 2010-2010 年期间应用的相同面板模型获得的相同系数的估计值进行比较2017.

基于 , I tried to compute a likelihood ratio test. In the linked discussion, they use a simple linear equation. If I use the same commands in R than described in the answer, I get results based on a 分布,我不明白我是否以及如何解释它。

中,我做了以下操作:

linearHypothesis(reg.pannel.recession.fe, "Exp_Fri=0.311576")

其中 reg.pannel.recession.fe 是 2007-2009 年期间的面板回归,Exp_Fri 是我要比较的此回归的系数,0.311576 是该期间的估计系数2010-2017.

我使用 linearHypothesis() 得到以下结果:

我该如何解释?我应该使用另一个函数,因为它是 个对象吗? 非常感谢您的帮助。

你在那个例子中得到了 F 检验,因为如插图中所述:

The method for "lm" objects calls the default method, but it changes the default test to "F" [...]

您也可以将检验设置为 F,但只要可以从方差-协方差矩阵估计系数的标准误差,基本上线性假设就起作用,正如小插图中所述:

The default method will work with any model object for which the coefficient vector can be retrieved by ‘coef’ and the coefficient-covariance matrix by ‘vcov’ (otherwise the argument ‘vcov.’ has to be set explicitly)

因此使用包中的示例:

library(plm)

data(Grunfeld)
wi <- plm(inv ~ value + capital,
data = Grunfeld, model = "within", effect = "twoways")

linearHypothesis(wi,"capital=0.3",test="F")
Linear hypothesis test

Hypothesis:
capital = 0.3

Model 1: restricted model
Model 2: inv ~ value + capital

  Res.Df Df      F  Pr(>F)  
1    170                    
2    169  1 6.4986 0.01169 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

linearHypothesis(wi,"capital=0.3")
Linear hypothesis test

Hypothesis:
capital = 0.3

Model 1: restricted model
Model 2: inv ~ value + capital

  Res.Df Df  Chisq Pr(>Chisq)  
1    170                       
2    169  1 6.4986     0.0108 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

你也可以使用 t.test:

tested_value = 0.3
BETA = coefficients(wi)["capital"]
SE = coefficients(summary(wi))["capital",2]
tstat =  (BETA- tested_value)/SE
pvalue = as.numeric(2*pt(-tstat,wi$df.residual))
pvalue
[1] 0.01168515