CafféSospeso - 7 months ago 54

R Question

I would like to compare two populations which have different means. I want to find a way to compare their variances, to have an idea of which of the two populations have values that disperse further from the mean.

The issues is that I think I should need a variance standardized/normalized on the mean value of each distribution.

Suggestions?

The next step would be to get a function in R that it is able to do that.

Answer

You don't need to standardise/normalise because variance is calculated as distance from the mean so is already normalised around the sample mean.

To demonstrate this run the following code

```
x<-runif(10000,min=100,max=101)
y<-runif(10000,min=1,max=2)
mean(x)
mean(y)
var(x)
var(y)
```

You'll see while the mean is different the variance of the two samples is identical (allowing for some difference due to pseudo-random number generation and sample size)

Source (Stackoverflow)