Covariance matrix syntax

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Oct 24 19:08:59 EDT 2020


On 25/10/20 4:49 am, Meghna Karkera wrote:
> Is there any syntax for covariance which uses the unbiased formula
> (yi-ymean)*(yj-ymean) /n...Monte Carlo method

I think you have "biased" and "unbiased" backwards. The formula
with n-1 is used when you want to calculate an *unbiased* estimate
for a population given a sample of that population.

The formula with n is used when your data consists of the entire
population.

Which situation do you have?

(I think the "bias" parameter to numpy.cov is badly named, btw.
If you're using it appropriately, setting biased=True does *not*
make your result biased -- quite the contrary!)

-- 
Greg


More information about the Python-list mailing list