I have six variables: sales (weekly), product category, customer segment, store location, week and product placement (aisle, entrance, ...). For each category, segment and location, I observe sales for different product placements. For the first three weeks, I observe "aisle", for weeks 4-6, I observe entrance and so on.
I am trying to estimate whether product placement has an impact on sales and what placement is maximizing sales. Here is a generated sample of my data in R for illustration:
library(dplyr) library(lme4) product_category <- c("catA", "catB", "catC", "catD", "catE") customer_segment <- c("custA", "custB", "custC") store_location <- c("locA", "locB", "locC", "locD") placement <- c("aisle", "window", "wherever") df1 <- expand.grid(product_category = product_category, customer_segment = customer_segment, store_location = store_location, placement = placement) weeks <- rep(1:3, each = 15, times = 4) df2 <- bind_cols(df1, sales = runif(dim(df1), 10, 100)) %>% arrange(store_location) %>% mutate(weeks = as.factor(weeks))
My first idea was to use linear regression and test the significance of product placement. However, my observations are most likely not independent (in terms of time and spatially) and I decided to use a mixed effect model, in which I treat placement as fixed effect and for all the other variables I add a random intercept. I use the lme4 package in R and my code looks as follows:
df2 <- df2 %>% mutate_if(is.character, as.factor) lme4::lmer(sales ~ placement + (1|weeks) + (1|product_category) + (1|customer_segment) + (1|store_location), data = df2, REML = F)
I am new to mixed effect models. Is this an appropriate way of estimating the impact of product placement? Are there alternatives?