Skip to content

Incorrect variance for Beta distribution? #1

@timueh

Description

@timueh

Hey there,

I drew samples for the beta distribution and noticed that the variance is off. It seems to be a structural issue. Any ideas?

a = 2; b = 2;
X = sample(@(x) (x.^(a-1).*(1-x).^(b-1) / beta(a,b)), [0 1], 100000);
mean(X), var(X) % = 0.5005, 0.0201

The analytical values for the mean and variance are

mu = a / (a + b) % 0.5
var = a*b/( (a+b)^2*(a+b+1) ) % 0.05

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions