回归输出中的重复值

时间:2019-06-15 10:11:40

标签: r output lme4

我在R中有一个线性混合回归输出,它重复两个交互的虚拟变量两次。重复的变量是FranceDummy0:Dummy2008_2009。如果有人能阐明为什么会这样,我将不胜感激。

输出:

Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: ExcessReturn ~ FranceDummy + FranceDummy:Dummy2008_2009 + FranceDummy:Dummy2010Onwards +  
    NetherlandsDummy + NetherlandsDummy:Dummy2008_2009 + NetherlandsDummy:Dummy2009Onwards +  
    OpenEnd + OpenEnd:Dummy2008_2009 + OpenEnd:Dummy2010Onwards +  
    ValueAddedDummy + ValueAddedDummy:Dummy2008_2009 + ValueAddedDummy:Dummy2010Onwards +  
    scale(BrentCrude) + scale(ExcessStock) + scale(RealGDP) +  
    scale(CPIGrowth) + scale(M1MoneySupply) + scale(InflationSurprise) +  
    scale(CPIGrowth):scale(InflationSurprise) + scale(RealGDP):scale(CPIGrowth) +  
    scale(CreditSpread) + scale(X10YearInterestRate) + scale(ExcessStock):NetherlandsDummy +  
    scale(GearingLag) + scale(I(GearingLag^2)) + scale(I(log(GAV +  
    1)^2)) + scale(log(GAV + 1)) + scale(Age) + scale(I(Age^2)) +      (1 | FundID)
   Data: panelsingle

REML criterion at convergence: -2853.8

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-5.9453 -0.3983 -0.0174  0.3878 12.2966 

Random effects:
 Groups   Name        Variance Std.Dev.
 FundID   (Intercept) 0.002041 0.04517 
 Residual             0.015097 0.12287 
Number of obs: 2427, groups:  FundID, 302

Fixed effects:
                                            Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)                               -8.483e-03  1.497e-02  8.990e+02  -0.567 0.571110    
FranceDummy1                               2.230e-02  2.707e-02  1.098e+03   0.824 0.410228    
NetherlandsDummy1                          6.473e-03  2.078e-02  7.544e+02   0.312 0.755456    
OpenEnd1                                  -3.256e-03  1.576e-02  8.381e+02  -0.207 0.836425    
ValueAddedDummy1                           3.754e-02  1.722e-02  8.801e+02   2.180 0.029534 *  
scale(BrentCrude)                         -1.694e-02  3.569e-03  2.324e+03  -4.746 2.21e-06 ***
scale(ExcessStock)                         4.956e-03  3.906e-03  2.263e+03   1.269 0.204670    
scale(RealGDP)                             2.400e-02  5.379e-03  2.394e+03   4.462 8.51e-06 ***
scale(CPIGrowth)                          -3.309e-03  3.308e-03  2.366e+03  -1.000 0.317223    
scale(M1MoneySupply)                       4.952e-03  3.550e-03  2.267e+03   1.395 0.163162    
scale(InflationSurprise)                  -2.312e-03  3.931e-03  2.199e+03  -0.588 0.556505    
scale(CreditSpread)                       -2.743e-02  4.284e-03  2.156e+03  -6.402 1.88e-10 ***
scale(X10YearInterestRate)                -2.692e-03  3.415e-03  2.191e+03  -0.788 0.430605    
scale(GearingLag)                          1.031e-01  1.081e-02  6.807e+02   9.534  < 2e-16 ***
scale(I(GearingLag^2))                    -1.378e-01  1.017e-02  9.595e+02 -13.556  < 2e-16 ***
scale(I(log(GAV + 1)^2))                   4.450e-02  1.336e-02  6.915e+02   3.332 0.000908 ***
scale(log(GAV + 1))                       -3.529e-02  1.269e-02  9.151e+02  -2.782 0.005518 ** 
scale(Age)                                -4.478e-02  9.516e-03  8.289e+02  -4.705 2.97e-06 ***
scale(I(Age^2))                            3.009e-02  9.518e-03  5.839e+02   3.161 0.001653 ** 
FranceDummy0:Dummy2008_20091              -7.214e-02  2.723e-02  2.313e+03  -2.649 0.008132 ** 
FranceDummy1:Dummy2008_20091              -1.028e-01  3.826e-02  2.295e+03  -2.687 0.007260 ** 
FranceDummy0:Dummy2010Onwards1            -7.420e-03  3.103e-02  2.377e+03  -0.239 0.811016    
FranceDummy1:Dummy2010Onwards1            -2.861e-02  3.922e-02  2.393e+03  -0.729 0.465888    
Dummy2008_20091:NetherlandsDummy1         -3.382e-02  2.788e-02  2.230e+03  -1.213 0.225193    
NetherlandsDummy0:Dummy2009Onwards1        4.450e-02  2.783e-02  2.273e+03   1.599 0.109998    
NetherlandsDummy1:Dummy2009Onwards1        3.336e-02  3.427e-02  2.367e+03   0.974 0.330361    
Dummy2008_20091:OpenEnd1                   5.475e-02  2.122e-02  2.261e+03   2.580 0.009935 ** 
Dummy2010Onwards1:OpenEnd1                 2.171e-02  1.643e-02  2.233e+03   1.321 0.186532    
Dummy2008_20091:ValueAddedDummy1          -5.917e-02  2.287e-02  2.253e+03  -2.587 0.009735 ** 
Dummy2010Onwards1:ValueAddedDummy1        -4.683e-02  1.787e-02  2.323e+03  -2.620 0.008839 ** 
scale(CPIGrowth):scale(InflationSurprise) -5.429e-05  3.242e-03  2.191e+03  -0.017 0.986639    
scale(RealGDP):scale(CPIGrowth)            2.056e-02  4.768e-03  2.239e+03   4.313 1.68e-05 ***
NetherlandsDummy1:scale(ExcessStock)      -1.955e-02  8.016e-03  2.195e+03  -2.438 0.014831 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

1 个答案:

答案 0 :(得分:1)

如果我很好地理解了您的问题,那么以下示例可以重现您的情况:

# create a normaly distributed random variable and 3 factors with 2 levels : 0 and 1
a = rnorm(3, n = 100)
b = rbinom(100, 1, 0.2)
c = rbinom(100, 1, 0.7)
d = rbinom(100, 1, 0.5)
df <- data.frame(a, b=as.factor(b), c=as.factor(c), d=as.factor(d)) # create a dataframe
mod <- lm(a ~ b + b:c + b:d, data = df) # fit linear regression model
summary(mod)
# Call:
# lm(formula = a ~ b + b:c + b:d, data = df)
# 
# Residuals:
#     Min      1Q  Median      3Q     Max 
# -2.3638 -0.7926  0.1332  0.7963  2.5876 
# 
# Coefficients:
#             Estimate Std. Error t value Pr(>|t|)    
# (Intercept)  2.69310    0.27043   9.959 2.25e-16 ***
# b1          -0.10971    0.54447  -0.202    0.841    
# b0:c1        0.05097    0.28810   0.177    0.860    
# b1:c1        0.69217    0.55119   1.256    0.212    
# b0:d1        0.10487    0.27033   0.388    0.699    
# b1:d1        0.06647    0.52216   0.127    0.899    
# ---
#   Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# 
# Residual standard error: 1.186 on 94 degrees of freedom
# Multiple R-squared:  0.03121, Adjusted R-squared:  -0.02032 
# F-statistic: 0.6057 on 5 and 94 DF,  p-value: 0.6957

变量b具有两个级别:0和1。因此,在summary()输出中,您可以看到相对于“ b0”级别定义的“ b1”估计值。交互是相同的:您可以估算“ b0:c1”交互,相对于“ b0:c0”定义,“ b1:c1”相对于“ b1:c0”定义,依此类推。如G5W所述,没有任何值在这里重复。

要查看所有交互级别的估算,例如,可以使用“效果”包中的allEffects()函数:

allEffects(mod)
# model: a ~ b + b:c + b:d
# 
# b*c effect
#   c
# b          0        1
#   0 2.693097 2.744071
#   1 2.583384 3.275555
# 
# b*d effect
#   d
# b          0        1
#   0 2.693097 2.797964
#   1 2.583384 2.649854