0
$\begingroup$

Assume following model:

$Sales_i = a +b_i*Price*Dummy+Advertsing*Dummy$

$Sales_i$ represent the sales in retailer i (either 1 or 2) and $Dummy$ is a dummy variable giving value 1 to retailer 2 and 0 to retailer 1.

Basically, I want to test formally whether the effects of price and advertising on the sales in retailer 1 differs significantly from the effects of price and advertising on sales in store 2.

I thought I could do this using an F-test. So I fitted a model $Sales = a+b_1*Price+b_2Advertising$ (no distinction between retailers here) and requested an anova table:

anova(model1, model2)

I am not sure if this is the right way to test this. Also, the anova table did not provide any P-value, so I don't know whether te reject or accept the F-test.

Can somebody please help me solving this?

$\endgroup$
3
  • $\begingroup$ Do you mean "b*price + advertising" or "b*(price + advertising)"? $\endgroup$ Commented Dec 10, 2014 at 15:10
  • $\begingroup$ I appoligize. I mean $Sales = a+b_1*Price + b_2*advertising$ $\endgroup$
    – Pieter
    Commented Dec 10, 2014 at 17:39
  • $\begingroup$ The model in your post does not look correct. There is no error term and also no parameters describing price and ad effects for retailer 1. $\endgroup$
    – Michael M
    Commented Dec 10, 2014 at 18:06

1 Answer 1

1
$\begingroup$

A minimum working example is helpful; e.g., I don't understand what precisely the "sales" and the "price" variables measure. Also, it seems to me that the models you specify are incorrect, as you specify interaction terms without including main-effect terms of the same variables. So my interpretation of your question, which may not make sense given the real data, is that you want to fit a model that contains up to a three-way interaction of "price", "advertising" and "store", e.g.,

$$\begin{align} \widehat{sales} = a &+ b_1 price + b_2 advertising + b_3 store_1 + b_4 (price \times advertising)\\&+ b_5 (price \times store_1) + b_6 (advertising \times store_1)\\&+ b_7 (price \times advertising \times store_1)\,. \end{align}$$

Here, $store_1$ refers to the second level of your factor "store", which is coded as $1$ in R. This model could be fitted in R as lm(sales ~ price * advertising * store, my.data), where my.data refers to the data frame in long format — one variable per column, one observation per row — that contains the variables included in the model. Passing the model to summary() will give you significance tests ($t$ ratios) of the coefficient estimates. If you also want an $F$ test of the the highest-order interaction term in the model, you can pass the model to drop1() and specify test = "F", like so:

my.mod <- lm(sales ~ price * advertising * store, my.data)
summary(my.mod)           # For "t" ratios for coefficient estimates
drop1(my.mod, test = "F") # For "F" ratio for three-way interaction term

drop1() compares the full alternative-hypothesis model to a second model that does not include, in this case, the three-way interaction term $b_7(price \times advertising \times store_1)$ and computes the changes in fit.

Here is a complete, albeit meaningless, example:

my.data <- data.frame("sales" = rnorm(100, 32.30),
                      "price" = rnorm(100, 6.99),
                      "advertising" = rnorm(100, 9.50),
                      "store" = factor(rep(c(".a", ".b"), each = 50))    )
my.mod <- lm(sales ~ price * advertising * store, my.data)
summary(my.mod)
drop1(my.mod, test = "F")
$\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.