0
$\begingroup$

Suppose I ask subjects to place a value on two cups: A and B; on a scale from -10 to +10.

She says A is worth -4 and B is worth 9.

Now I say 'ok pick one'. She picks one. Now I ask 300 people the same thing.

Simply, I want to model how their valuation of the options predicts which cup they pick (e.g. the greater the value they assign to one over the other, the more likely they are to pick it).

What's the model?

(I want to use a linear model because I want to control for other factors).

Thank you!

$\endgroup$
0
$\begingroup$

Here is my dumb example how I would do it. I'll just generate some random data. Basically you take the difference of the scores of A and B and use your glm model.

> library(lme4)
> df=data.frame(thot=rep(c("Alice","Barbara"),each=50),
>               value=runif(100,-10,10)-runif(100,-10,10))
> df$cup=factor(sample(rep(c("A","B"),each=50)))
> summary(glmer(cup~value+(1|thot),data=df,family=binomial(link="logit")))

Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: binomial  ( logit )
Formula: cup ~ value + (1 | thot)
   Data: df

     AIC      BIC   logLik deviance df.resid 
   142.9    150.7    -68.4    136.9       97 

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-1.33077 -1.00604  0.00095  0.99804  1.31654 

Random effects:
 Groups Name        Variance Std.Dev.
 thot   (Intercept) 0        0       
Number of obs: 100, groups:  thot, 2

Fixed effects:
            Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.02589    0.20274  -0.128    0.898
value        0.03221    0.02444   1.318    0.187

Correlation of Fixed Effects:
      (Intr)
value -0.097

Edit sample of data

> head(df)
   thot     value cup
1 Alice  2.899886   B
2 Alice  9.030560   B
3 Alice  1.281790   B
4 Alice 16.263392   B
5 Alice -5.369385   A
6 Alice  6.438415   A
$\endgroup$
  • $\begingroup$ Great, thanks! So here's a dumb follow up(!): First, what's the data frame look like? Is it one column for 'Alice' or 'Barbara', and another column for 'difference'? So, one column looks like 'alice, alice, alice, barbara, barbara, alice...', and the other looks like '-2, -5, 6, -1, 4...' ? Second, what's 'thot' here? thanks again... (new (ish) to models) $\endgroup$ – cathalcom Feb 6 at 15:35
  • $\begingroup$ @cathalcom I posted the whole code so you can check the whole process / data yourself in R, I added a snip of the data in the answer. Thot is the column for the people (all women in this case, alice and barbara), value is the difference in the scores of a and b, cup is what cup was selected. $\endgroup$ – user2974951 Feb 6 at 15:38
  • $\begingroup$ Ah, right got it. Checked. Thanks. So, if for example all the scores were negative, would the model take that to be a significant bias toward picking the cup they ranked negatively? (that's what I'm predicting in my case). Also, I only have one observation per participant; will that affect things? $\endgroup$ – cathalcom Feb 6 at 15:57
  • $\begingroup$ Finally, is the directionality in the difference based on the one in column 'cup'? So, in line 5 in the snippet, A is 5 points lower than B; while in line 4, B is 16 points higher than A. Is that right? So, if Alice had picked B in trial 5, that would read 'Alice, +5, B'. $\endgroup$ – cathalcom Feb 6 at 17:36
  • $\begingroup$ @cathalcom I though your objective was to predict which cup they were going to predict, as for if all the scores were negative I really can't tell what would happen. if you have only one observation you do not need a mixed model such as I used, a regular glm would work. The score is always computed the same way, A - B, which means if the difference is positive then A had higher score, otherwise A had lower score. $\endgroup$ – user2974951 Feb 7 at 7:47

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.