2
$\begingroup$

I am trying to build a hierarchical linear model based on data structured like this dataset below. The model form I am looking to build is

Purchased ~ f(price + color + more item attributes + age + gender + other person attributes)

Betaprice ~ f(age + gender + other person attributes)

Does anyone know a good approach for this?

 person item purchased age  gender  Color   Price
    1   1    1         23   F     Blue      20
    1   2    0         23   F     Red       15
    1   3    1         23   F     Green     18
    2   1    0         34   M     Blue      20
    2   2    1         34   M     Red       15
    2   3    0         34   M     Green     18
    3   1    1         19   M     Blue      20
    3   2    1         19   M     Red       15
    3   3    0         19   M     Green     18
$\endgroup$
2
$\begingroup$

I'm not really sure if I understand the question correctly but since I'm not able to comment due to my less reputation I'll post an answer:

I assume this can be done via a linear mixed model, where the persons are random samples. But to answer your question: What is your goal? Do you want to know which persons buy something? Or do you want to know which persons buy something special? Or a special color? I assume you are interested in the total purchase of one person, so in R maybe something like

library(lme4)
fit<- lmer(Price ~ person + (1 | item/color/purchased) + (1 | gender) + (1 | age) + (1 + person | item)..)
$\endgroup$
  • $\begingroup$ My goal is to predict how sensitive a member is to price based on attributes about that individual. In the end, I want to be able to compute kind of like a price elasticity at the individual level. $\endgroup$ – user295944 Nov 4 '17 at 17:56
  • 1
    $\begingroup$ Interesting. How many individuals do you have? And in which way shall the model be hierarchically? $\endgroup$ – Ben Nov 4 '17 at 18:07
  • $\begingroup$ In my sample now, I have about 5k individuals and 5 items. I can get more though. I am not sure how the hierarchy is structures, which is why I'm on here ;) . I know I would like to predict probability of purchase for each item and the beta on price be a function of attributes about individuals. $\endgroup$ – user295944 Nov 6 '17 at 16:37
  • $\begingroup$ I guess what you are looking for are so-called logistic-functions/models. But I only stumbled over them and it looks appropriate to me because you are having a boolean factor (purchased yes/no). But I'm not sure since the predicted probability won't be a boolean, of course. I will think about it. $\endgroup$ – Ben Nov 7 '17 at 17:21
  • 1
    $\begingroup$ right now I'm just trying a logistic regression with purchased~color + attribute2 + attribute3+...+ price + price:age + ... then after I can obtain the price coefficients and build a formula like 1(price coef)+age(price:age coef)+... $\endgroup$ – user295944 Nov 8 '17 at 18:09

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.