I am writing a function to standardize the data and I found out that we can choose either ddof = 0 or ddof = 1, so I got confused that which one to choose and why? Does this make any difference?
1 Answer
$\begingroup$
$\endgroup$
3
ddof represents the degrees of freedom adjustment when you subtract from N in the standard deviation formula below. So I suggest that if you are working with a sample from a population, and you want an unbiased estimate then you use ddof=1. If you want to consider it as a population you can use ddof=0.
$$ S= \sqrt{ \dfrac{1}{N-1}\sum_{i=1}^N \bigg( X_i-\bar X \bigg)^2 } $$
-
$\begingroup$ In addition to @Ralph's answer, usually the choice of DDOF does not make much impact since 1) the difference is small for large N; and 2) it is just a scaling to feature which (AFAIK) every models can cope with. $\endgroup$– lpounngCommented May 24, 2022 at 4:26
-
$\begingroup$ Amazingly, the square root of that unbiased estimator of variance is a biased estimator of standard deviation. $\endgroup$– DaveCommented May 24, 2022 at 10:11
-
$\begingroup$ I had never heard of the term Delta Degrees of freedom, but had to look it up. Not a statistical term $\endgroup$ Commented May 24, 2022 at 16:48