Take the 2-minute tour ×
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.

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
1  
We already answered that in your other post stats.stackexchange.com/questions/24772/… . 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
add comment

migrated from stackoverflow.com Mar 19 '12 at 16:25

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

1 Answer

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
add comment

Your Answer

 
discard

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.