0
$\begingroup$

I have fake dataframe with neighbrhood codes and prices of houses in those neighbrhoods, with this amount of values for each negihborhood:

df['neighb'].value_count()

>>>
a    17
b    5
c    3
d    2
e    2
f    1
g    1
f    1

I need to check if there is significant difference in the prices between the neighbrhoods. The problem is that some neighbrhoods have price of only one house, so I don't have group of values as I only have data regard this one house specifically.

Assuming that I cannot get more data regard house prices, (in this task)

Is there any way I can calcualte if there is significant difference in the prices between the different groups? I wanted to use ANOVA but as the groups are really little I find it problematic (also regard the assumption of normal distribution etc).

*clarification : my real database is not prices of houses, is somethiing that I cannot get more data then what I want but I do need to check if there is significant differences between different neighbrhoods when some have alamost no observations.

$\endgroup$
1
  • $\begingroup$ If you have only one price for some groups, I wonder whether you you can do an ANOVA that includes these groups. In your data, maybe you can combine (f,g,h) into a group called 'other'. $\endgroup$
    – BruceET
    Commented Mar 28, 2021 at 23:26

1 Answer 1

1
$\begingroup$

Consider the following simulated data. Notice that standard deviations differ by group, so I use the oneway.test procedure, which uses a Saterthwaite approximation to give a reasonable P-value.

set.seed(2021)
a = rnorm(17, 1000, 10)
b = rnorm( 5, 800,  10)
c = rnorm( 3, 2000, 15)
d = rnorm( 2,  500,  8)
e = rnorm( 2, 1100, 10)
fgh = rnorm( 3, 800, 20)
x = c(a,b,c,d,e,fgh)
g = rep(1:6, c(17,5,3,2,2,3)) 

This one-way ANOVA procedure works fine, and finds a highly significant difference among groups in my simulated data.

oneway.test(x ~ g)

    One-way analysis of means 
    (not assuming equal variances)

data:  x and g
F = 2317.8, num df = 5.0000, denom df = 5.1515, p-value = 1.298e-08

Using the Bonferroni method to protect against 'false discovery' in ad hoc tests on these data, you might reject two-sample Welch t tests only for P-values below 1%.

It is not surprising to find a sigificant difference ad hoc between a and b because of the difference in sample means and 'reasonable' sample sizes of 17 and 5.

t.test(a,b)$p.val
[1] 5.717784e-09

But some pairs of groups with very small sample sizes are also significantly different. For example,

t.test(c,e)$p.val
[1] 0.0001867002

Of course, I cannot say what will happen with your real data, but at least we know that oneway.test with ad hoc comparisons using Welch t tests is not automatically doomed to failure. I would say that comparisons of the group fgh of 'leftovers' might be difficult to interpret, but you really don't have meaningful data there.

$\endgroup$
1
  • $\begingroup$ thank you for your answer. so if I understood you correct, you reccoment to use the one-way ANOVA test even if I cannot check the assumptions, and use the Bonferroni method in order to make sure I select the best a value? and also , you were assuming that groups with one observations can create new group together? (im working with python so i'm appologize if I did not understood some things you did) $\endgroup$
    – Reut
    Commented Mar 29, 2021 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.