I am just learning R, and am aware that the package e1071 has a
naiveBayes method that takes in predictor and class membership, and estimates the class prior using the relative frequency (ML estimate).
I would like to see the impact of having a sample that is not balanced across classes (let's say male, female are represented in 3:7 ratio in the available data), when I know that for the population I am interested in, the prior of male, female would be much closer to 0.5:0.5 than 0.3:0.7. The skewed representation is due to practical problems in sampling/surveying.
I've tried doing a down-sampling of the female subset to make the training set reflect the 1:1 ratio. Is there a way of using
naiveBayes with a pre-specified prior that is not reflected in the relative frequency in the data? I've looked through the documentation on
e1071::naiveBayes and there does not seem to be any way of specifying my own prior.
Is there another package that does that?