== Pseudocode is valid Python, but gets tripped up by integer division ==
Would anyone object to a note pointing out that the pseudocode can be run verbatim in a Python intepreter, but that in Python < 3.0 you'll need a <source lang="python">from __future__ import division</source> statement. (Can you tell I just got caught out by this? :D) [[User:Alexsdutton|Alexsdutton]] ([[User talk:Alexsdutton|talk]]) 15:05, 23 December 2010 (UTC)
: I'm torn. Perhaps the text should say it is Python 3.0? I am loathe to add that line to an otherwise beautiful looks-like-pseudocode example, but as you say, the gotcha is easy to fall into... [[User:BenFrantzDale|—Ben FrantzDale]] ([[User talk:BenFrantzDale|talk]])
::I think it would be inappropriate. The whole idea of pseudocode is that it's not language specific. -- [[User:RoySmith|RoySmith]] [[User Talk:RoySmith|(talk)]] 18:52, 25 December 2010 (UTC)
== Divide by n vs n-1? ==
Can somebody explain why there are two different flavors of the formula for variance, one where you divide by n, the other where you divide by n-1? Obviously, for large values of n, they approach each other, but why the difference at all? -- [[User:RoySmith|RoySmith]] [[User Talk:RoySmith|(talk)]] 18:55, 25 December 2010 (UTC)
: Wikipedia's mathematics reference desk would probably be a better place for this sort of question.
: Notice that
:* The rule that
::: var(''X'' + ''Y'') = var(''X'') + var(''Y'')
:: when ''X'' and ''Y'' are [[independence (probability theory)|independent]] [[random variable]]s applies when you divide by ''n'' and '''not''' when you divide by ''n'' − 1.
:* Dividing by ''n'' − 1 is done when one is trying to [[estimation (statistics)|estimate]] the variance of a population by using a random sample. It should never be done when one has the whole population and the variance can be computed exactly. It's effect is to make the estimate [[bias (statistics)|unbiased]]. That's not really all that good a reason to do it, but that's why it's done. See [[Bessel's correction]] for an account of some of the mathematical theory.
:* This is standard textbook material. Maybe more of it should be included in the article.
: [[User:Michael Hardy|Michael Hardy]] ([[User talk:Michael Hardy|talk]]) 19:28, 25 December 2010 (UTC)
|