I am fitting a model to some sales data and looking to accurately represent male/female behaviour (e.g basket analysis).

For example, I know the proportion of females/males in the population buying these products are 50:50, and my products are identical to competitor products, however, my data contains 30% females and 70% males. I believe this may bias my model, and from what I can learn, I need to apply a weighting function.

I am using R and lm() to model. If using weighting is the right way to go, how is it represented in lm(x,y,weighting=)? E.g. do males receive a weighting of .3 to counter their over representation? or what would be the appropriate weighting in this case?


Your population of interest is the set of people that have bought something from your company--not the overall population of all living humans around the world...

If your sales data represents that of the entire company then you have your population data right there. If not, is your data a simple random sample? Or is there reason to suggest a systematic bias in the way the data was collected? (The mere fact that 70% of the data comes from men does not necessarily mean that your data is biased--it could just mean that 70% of your customers are men).

Suggestion: Your first step should be to test whether the average sale generated from a male buyer is different from that of a female buyer--if they aren't different than there's no point worrying about prediction on the basis of sex. My suggestion is that you use Welch's t-test (it's like a regular t-test but the variances don't necessarily have to be equal) and first test to see if the buying habits really are different.

First do this and then save the prediction stuff for later.


The best (and also the easiest) approach is to analyze your data according to either a per-customer (if possible) or a per-sale basis--that way you won't have to worry about the discrepancy in representation between men and women. This approach will simplify your current step but also lead to a more nuanced analysis down the road since you'll be able to decompose total revenue into:

  1. Avg. revenue generated per sale
  2. Total number of sales

Make sense?

  • $\begingroup$ Thanks Steve, you're right, my question looked silly after what you said. I am trying to put it as simply as I can, I've reworded the question accordingly. $\endgroup$ – Michael Plazzer Aug 12 '14 at 0:40
  • $\begingroup$ @user13506: It's not silly--it's a perfectly valid issue to raise... I'll try to edit my answer accordingly. $\endgroup$ – Steve S Aug 12 '14 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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