How do I predict the sales at the mean price level for each brand in this cvs file?
And then how do I model sales as a function of the interaction between price and brand, and the other interaction between price and feature, using log?
This is what I have done for the first part:
x = mean(drinks$price)
print(x)
but I don't understand how I can get the mean price for each individual brand and then predict the sales for each of those brands.
Here is a part of my csv file (called drinks.cvs):
# store week  brand     sales   price  feature
1   2   40  tropicana   8256    3.87    0
2   2   46  tropicana   6144    3.87    0
3   2   47  tropicana   3840    3.87    0
4   2   48  tropicana   8000    3.87    0
5   2   50  tropicana   8896    3.87    0
6   2   86  minute.maid 15104   2.09    0
7   2   87  minute.maid 76480   1.39    1
8   2   88  minute.maid 5056    2.39    0
9   2   89  minute.maid 4736    2.39    0
10  2   90  minute.maid 4480    2.39    0
11  2   140 dominicks   4800    2.09    0
12  2   141 dominicks   9664    1.69    0
13  2   142 dominicks   45568   1.69    0
14  2   143 dominicks   20992   1.74    0
15  2   144 dominicks   6592    2.09    0
 
    