Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anybody know the way to construct a Bayesian classifier in R for two bi-variate gaussian distributions of which the means and variances are known? The two classes are equi-probable and the variables are independent from each other.

Any help is deeply appreciated.

share|improve this question

migrated from Mar 19 '12 at 16:25

This question came from our site for professional and enthusiast programmers.

We already answered that in your other post… . You just have to check inequality (*). What is the deal of doing that? – Zen Mar 19 '12 at 19:44
Hi, thanks for the comment. What you mean is, that I need to do the entire set of steps in deriving the Bayesian classifier as you showed in the above post in R too? I am interested in knowing whether there is a method specific to R in doing that here. – picmate Mar 20 '12 at 21:59

When you have known means / variances, this classifier amounts to just finding the likelihood of your sample under the two models and choosing the one that's greater. I don't use R, but it looks like dnorm2d or dmvnorm will find likelihoods for you; dnorm2d is bivariate-specific but you have to subtract the mean off and maybe divide by sigmas yourself, while dmvnorm will do those for you but you have to make the 2x2 covariance matrix yourself.

I'm not sure what you mean by the variables being independent: that you're dealing with IID samples of pairs, or that the two elements of the vector are independent? In the latter case, you could also just use 1D normal likelihoods and multiply them.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.