1
$\begingroup$

I want to test gender differences in an outcome variable called the willingness to pay. My data consists of records with following three fields: person_id, person_gender, and willingness_to_pay (in dollars). Willingness to pay was obtained from some users multiple times. So I have multiple records for some users.

I understand that following would be incorrect:

t.test(willingness_to_pay ~ person_gender, paired = FALSE, data = myData)

How do I account for nesting with person_id? Please help.

$\endgroup$
3
  • 1
    $\begingroup$ You could try a bootstrap approach, or even better a linear model with random effects as your person_id. $\endgroup$ Commented Oct 5, 2018 at 10:15
  • $\begingroup$ Would that mean lmer(willingness_to_pay ~ person_gender + (1|person_id), data=myData)? $\endgroup$
    – SanMelkote
    Commented Oct 5, 2018 at 13:07
  • 1
    $\begingroup$ Formula looks good, check if all other assumptions of the model are met (similar to a linear model). $\endgroup$ Commented Oct 5, 2018 at 13:40

1 Answer 1

1
$\begingroup$

It is hard to tell what you actually want to do. In order to test the differences in willingness to pay and formulate the model you have to construct the model in a way that it meets your research question. The central question is: Why do you have repeated measures of willingness to pay? You could for example either compare changes between the groups or within the groups. If you want to compare between the groups lmer(willingness_to_pay ~ person_gender + (1|person_id), data=myData) is fine and the Random Effect can account for the repeated measures from the same individuals. However, you should consider that it may be necessary to include a time variable that indicates the "measurement moments" because your willingness to pay may be dependent on the moment respondents stated it. If you interested in within-group-comparison you can also use a paired t-testt.test(x=wtp.moment.1, y=wtp.moment2, alternative = c("two.sided"),var.equal = T, conf.level=0.95) to see if there were significant changes in willingness to pay within the groups (gender) at different moments of measurement. Of course you can also construct a mixed-effect model for this by including a variable that accounts for the "moment of measurement" and its interaction with participants' gender lmer(willingness_to_pay ~ person_gender * moment + (1|person_id), data=myData).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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