3个变量的虚拟编码导致不适用

时间:2019-06-06 10:12:02

标签: r

我试图用4个方程(2个直接影响和2个中介影响)估计一个看似无关的回归模型。我的模型中有3个虚拟变量,它们在输出中得到NA分数。虚拟变量来自测量购物渠道偏好的变量:1 =在线2 =离线3 =无偏好。首先,当我制作虚拟人物时,我仅制作了2个虚拟人物:Online_preference和Offline_preference,其中1代表Online / Offline偏好,其他代表零。结果对我来说似乎很奇怪,然后我添加了第三个哑元,即No_preference,表示无偏好为1,所有其他指示为0。

我还尝试将原始变量channel.preference包含为包含值1、2和3的因数。但是,截距变为1。因此没有要解释的截距。我的硕士论文需要这个。

库(系统调整)

eq1 <- loyalonline ~ Channel_preference_NO + Channel_preference_offline + Channel_preference_online + X.shop.on + X.shop.off + Integration + servqual_online + servqual_offline + assortment_online + assortment_offline + price_online + price_offline + image_offline + image_online

eq2 <- loyaloffline ~ Channel_preference_NO + Channel_preference_offline + Channel_preference_online + X.shop.on + X.shop.off + Integration + servqual_online + servqual_offline + assortment_online + assortment_offline + price_online + price_offline + image_offline + image_online

eq3 <- image_offline ~ Channel_preference_NO + Channel_preference_offline + Channel_preference_online + X.shop.on + X.shop.off + Integration + servqual_online + servqual_offline + assortment_online + assortment_offline + price_online + price_offline + image_online

eq4 <- image_online ~  Channel_preference_NO + Channel_preference_offline + Channel_preference_online + X.shop.on + X.shop.off + Integration + servqual_online + servqual_offline + assortment_online + assortment_offline + price_online + price_offline + image_offline 

fitsur <- systemfit(list(eq1, eq2, eq3, eq4), "SUR", data=surveydata2) 

summary(fitsur)

这为第一个方程式产生了以下输出:

SUR estimates for 'eq1' (equation 1)
Model Formula: loyalonline ~ Channel_preference_NO + Channel_preference_offline + 
    Channel_preference_online + X.shop.on + X.shop.off + Integration + 
    servqual_online + servqual_offline + assortment_online + 
    assortment_offline + price_online + price_offline + image_offline + 
    image_online

                               Estimate   Std. Error  t value Pr(>|t|)  
(Intercept)                -8.197137062           NA       NA       NA  
Channel_preference_NO       8.492880678           NA       NA       NA  
Channel_preference_offline  8.931039829           NA       NA       NA  
Channel_preference_online   8.740189838           NA       NA       NA  
X.shop.on                  -0.000937155  0.086172689 -0.01088 0.991334  
X.shop.off                  0.116146382  0.087283445  1.33068 0.184881  
Integration                -0.086697750  0.139339296 -0.62221 0.534548  
servqual_online             0.407035659  0.162080604  2.51132 0.012857 *
servqual_offline           -0.198559780  0.127637103 -1.55566 0.121445  
assortment_online           0.262651479  0.123362918  2.12910 0.034527 *
assortment_offline          0.079556741  0.121200399  0.65641 0.512353  
price_online                0.071331977  0.114409532  0.62348 0.533713  
price_offline              -0.001153320  0.110379210 -0.01045 0.991674  
image_offline               0.153717670  0.135150835  1.13738 0.256805  
image_online                0.285603534  0.143154315  1.99507 0.047456 *

As can be seen the first 3 variables are NA.
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.92452 on 191 degrees of freedom
Number of observations: 206 Degrees of Freedom: 191 
SSR: 163.254828 MSE: 0.854737 Root MSE: 0.92452 
Multiple R-Squared: 0.293031 Adjusted R-Squared: 0.241212 


SUR estimates for 'eq2' (equation 2)
Model Formula: loyaloffline ~ Channel_preference_NO + Channel_preference_offline + 
    Channel_preference_online + X.shop.on + X.shop.off + Integration + 
    servqual_online + servqual_offline + assortment_online + 
    assortment_offline + price_online + price_offline + image_offline + 
    image_online

                              Estimate  Std. Error  t value   Pr(>|t|)    
(Intercept)                 11.3664256          NA       NA         NA    
Channel_preference_NO      -11.3321726          NA       NA         NA    
Channel_preference_offline -11.3754037          NA       NA         NA    
Channel_preference_online  -10.9301111          NA       NA         NA    
X.shop.on                    0.1025450   0.0701521  1.46175   0.145452    
X.shop.off                  -0.0933838   0.0710563 -1.31422   0.190348    
Integration                  0.0336123   0.1134343  0.29631   0.767312    
servqual_online             -0.1408759   0.1319477 -1.06766   0.287019    
servqual_offline             0.1672898   0.1039077  1.60998   0.109053    
assortment_online            0.2332130   0.1004282  2.32219   0.021277 *  
assortment_offline           0.1754046   0.0986677  1.77773   0.077039 .  
price_online                -0.0202389   0.0931393 -0.21730   0.828209    
price_offline                0.1893764   0.0898583  2.10750   0.036379 *  
image_offline                0.6943886   0.1100246  6.31122 1.8889e-09 ***
image_online                -0.2262248   0.1165401 -1.94118   0.053709 .  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.75264 on 191 degrees of freedom
Number of observations: 206 Degrees of Freedom: 191 
SSR: 108.195146 MSE: 0.566467 Root MSE: 0.75264 
Multiple R-Squared: 0.462038 Adjusted R-Squared: 0.422607 


SUR estimates for 'eq3' (equation 3)
Model Formula: image_offline ~ Channel_preference_NO + Channel_preference_offline + 
    Channel_preference_online + X.shop.on + X.shop.off + Integration + 
    servqual_online + servqual_offline + assortment_online + 
    assortment_offline + price_online + price_offline + image_online

                              Estimate  Std. Error  t value   Pr(>|t|)    
(Intercept)                -43.5016667          NA       NA         NA    
Channel_preference_NO       43.5551857          NA       NA         NA    
Channel_preference_offline  43.6567223          NA       NA         NA    
Channel_preference_online   43.5747272          NA       NA         NA    
X.shop.on                    0.0888251   0.0455753  1.94897  0.0527554 .  
X.shop.off                  -0.0393647   0.0462627 -0.85090  0.3958874    
Integration                 -0.1678208   0.0736773 -2.27778  0.0238413 *  
servqual_online             -0.0832320   0.0861682 -0.96592  0.3352971    
servqual_offline             0.1905985   0.0653210  2.91788  0.0039448 ** 
assortment_online           -0.2704448   0.0641071 -4.21864 3.7859e-05 ***
assortment_offline           0.3843459   0.0589268  6.52243 5.9783e-10 ***
price_online                 0.0313554   0.0610573  0.51354  0.6081640    
price_offline                0.0298582   0.0588896  0.50702  0.6127223    
image_online                 0.7071729   0.0659574 10.72165 < 2.22e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.516626 on 192 degrees of freedom
Number of observations: 206 Degrees of Freedom: 192 
SSR: 51.245306 MSE: 0.266903 Root MSE: 0.516626 
Multiple R-Squared: 0.419614 Adjusted R-Squared: 0.380317 


SUR estimates for 'eq4' (equation 4)
Model Formula: image_online ~ Channel_preference_NO + Channel_preference_offline + 
    Channel_preference_online + X.shop.on + X.shop.off + Integration + 
    servqual_online + servqual_offline + assortment_online + 
    assortment_offline + price_online + price_offline + image_offline

                               Estimate   Std. Error  t value   Pr(>|t|)    
(Intercept)                 1.56961e+01  4.43470e+05  0.00004  0.9999718    
Channel_preference_NO      -1.53648e+01  4.43470e+05 -0.00003  0.9999724    
Channel_preference_offline -1.53712e+01  4.43470e+05 -0.00003  0.9999724    
Channel_preference_online  -1.55130e+01  4.43470e+05 -0.00003  0.9999721    
X.shop.on                  -5.76136e-02  4.33280e-02 -1.32971  0.1851924    
X.shop.off                 -3.14545e-02  4.37076e-02 -0.71966  0.4726109    
Integration                 1.56339e-01  6.95914e-02  2.24653  0.0258089 *  
servqual_online             2.29307e-01  7.93302e-02  2.89054  0.0042887 ** 
servqual_offline            3.65699e-03  6.34783e-02  0.05761  0.9541191    
assortment_online           3.26501e-01  5.80803e-02  5.62154 6.5952e-08 ***
assortment_offline         -2.67714e-01  5.92847e-02 -4.51574 1.0996e-05 ***
price_online               -2.42917e-02  5.76610e-02 -0.42128  0.6740188    
price_offline              -1.15770e-02  5.56388e-02 -0.20807  0.8353910    
image_offline               6.30310e-01  5.87885e-02 10.72165 < 2.22e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.487743 on 192 degrees of freedom
Number of observations: 206 Degrees of Freedom: 192 
SSR: 45.675433 MSE: 0.237893 Root MSE: 0.487743 
Multiple R-Squared: 0.478546 Adjusted R-Squared: 0.443239 

这里有人知道如何解决吗? 提前谢谢!

0 个答案:

没有答案