多列的回归,其中一列在R中包含超过20000个不同的值

问题描述 投票:0回答:1

我应该如何对在一列中包含175个唯一值的数据集进行回归分析?以下是我的数据集。如您所见,变量“ Neighbourhood”包含超过20,000个值,其中175个是唯一的。如果要在线性回归中包含变量,是否可以?非常感谢任何提示。

glimpse(dataset)
            ID                Company          Price      
     Min.   :  1002   2nd Address:13383   Min.   :  480  
     1st Qu.:252532   Common     :10456   1st Qu.:  830  
     Median :499923   LikeHome   :13735   Median : 1320  
     Mean   :500837                       Mean   : 1691  
     3rd Qu.:750373                       3rd Qu.: 1980  
     Max.   :999986                       Max.   :10360  

               Country                      City      
     Germany       :13661   Amsterdam         :14766  
     Netherlands   :14976   Berlin            :13603  
     Sweden        :  993   Edinburgh         : 7868  
     United Kingdom: 7944   Stockholm         :  509  
                            Amsterdam-Zuidoost:  137  
                            (Other)           :  678  
                            NA's              :   13  
                     Neighbourhood      Zipcode     
     De Baarsjes - Oud-West : 2897   10245  :  607  
     De Pijp - Rivierenbuurt: 1988   10247  :  540  
     Centrum-West           : 1640   10437  :  515  
     Westerpark             : 1251   10115  :  486  
     Centrum-Oost           : 1186   10997  :  433  
     Oud-Oost               : 1051   (Other):33711  
     (Other)                :27561   NA's   : 1282  
r dplyr regression linear-regression data-manipulation
1个回答
0
投票

在我看来,您最好使用多级模型,而不是为邻居添加> 20000个虚拟变量。参见例如https://rpubs.com/rslbliss/r_mlm_ws

© www.soinside.com 2019 - 2024. All rights reserved.