0
$\begingroup$

I compared levels of categorical variable by their respected mean, obtain from continuous response variable using pivot table. I found that some of the levels is having nearly equal mean e.g 'BrDale' and 'IDOTRR' in below table

   Neighborhood      SalePrice
0       Blmngtn  194870.882353
1       Blueste  137500.000000
2        BrDale  104493.750000
3       BrkSide  124834.051724
4       ClearCr  212565.428571
5       CollgCr  197965.773333
6       Crawfor  210624.725490
7       Edwards  128219.700000
8       Gilbert  192854.506329
9        IDOTRR  100123.783784
10      MeadowV   98576.470588
11      Mitchel  156270.122449
12        NAmes  145847.080000
13      NPkVill  142694.444444
14       NWAmes  189050.068493
15      NoRidge  335295.317073
16      NridgHt  316270.623377
17      OldTown  128225.300885
18        SWISU  142591.360000
19       Sawyer  136793.135135
20      SawyerW  186555.796610
21      Somerst  225379.837209
22      StoneBr  310499.000000
23       Timber  242247.447368
24      Veenker  238772.727273  

I bundled this type of levels and create new variable with few levels and more specific variation among them

  location_class      SalePrice
0        class_1  100746.857143
1        class_2  129537.452450
2        class_3  147148.905844
3        class_4  193255.619048
4        class_5  218644.600000
5        class_6  241467.408163
6        class_7  314856.009804
7        class_8  335295.317073  

After this I perform OLS on both variable separately and obtained R square and F value as follow

                      R square       F value
   Neighborhood   :  0.545574        71.784
   location_class :  0.5425970       246.063

I want to know if this is right approach. If not then what else I can do.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.