orangeJuice | R Documentation |
Weekly sales of refrigerated orange juice at 83 stores. Contains demographic information on those stores.
data(orangeJuice)
The orangeJuice
object is a list containing two data frames, yx
and storedemo
.
In the yx
data frame:
...$store | store number |
...$brand | brand indicator |
...$week | week number |
...$logmove | log of the number of units sold |
...$constant | a vector of 1s |
...$price# | price of brand # |
...$deal | in-store coupon activity |
...$feature | feature advertisement |
...$profit | profit |
The price variables correspond to the following brands:
1 | Tropicana Premium 64 oz |
2 | Tropicana Premium 96 oz |
3 | Florida's Natural 64 oz |
4 | Tropicana 64 oz |
5 | Minute Maid 64 oz |
6 | Minute Maid 96 oz |
7 | Citrus Hill 64 oz |
8 | Tree Fresh 64 oz |
9 | Florida Gold 64 oz |
10 | Dominicks 64 oz |
11 | Dominicks 128 oz |
In the storedemo
data frame:
...$STORE | store number |
...$AGE60 | percentage of the population that is aged 60 or older |
...$EDUC | percentage of the population that has a college degree |
...$ETHNIC | percent of the population that is black or Hispanic |
...$INCOME | median income |
...$HHLARGE | percentage of households with 5 or more persons |
...$WORKWOM | percentage of women with full-time jobs |
...$HVAL150 | percentage of households worth more than $150,000 |
...$SSTRDIST | distance to the nearest warehouse store |
...$SSTRVOL | ratio of sales of this store to the nearest warehouse store |
...$CPDIST5 | average distance in miles to the nearest 5 supermarkets |
...$CPWVOL5 | ratio of sales of this store to the average of the nearest five stores |
Alan L. Montgomery (1997), "Creating Micro-Marketing Pricing Strategies Using Supermarket Scanner Data," Marketing Science 16(4) 315–337.
Chapter 5, Bayesian Statistics and Marketing by Rossi, Allenby, and McCulloch.
## load data
data(orangeJuice)
## print some quantiles of yx data
cat("Quantiles of the Variables in yx data",fill=TRUE)
mat = apply(as.matrix(orangeJuice$yx), 2, quantile)
print(mat)
## print some quantiles of storedemo data
cat("Quantiles of the Variables in storedemo data",fill=TRUE)
mat = apply(as.matrix(orangeJuice$storedemo), 2, quantile)
print(mat)
## processing for use with rhierLinearModel
if(0) {
## select brand 1 for analysis
brand1 = orangeJuice$yx[(orangeJuice$yx$brand==1),]
store = sort(unique(brand1$store))
nreg = length(store)
nvar = 14
regdata=NULL
for (reg in 1:nreg) {
y = brand1$logmove[brand1$store==store[reg]]
iota = c(rep(1,length(y)))
X = cbind(iota,log(brand1$price1[brand1$store==store[reg]]),
log(brand1$price2[brand1$store==store[reg]]),
log(brand1$price3[brand1$store==store[reg]]),
log(brand1$price4[brand1$store==store[reg]]),
log(brand1$price5[brand1$store==store[reg]]),
log(brand1$price6[brand1$store==store[reg]]),
log(brand1$price7[brand1$store==store[reg]]),
log(brand1$price8[brand1$store==store[reg]]),
log(brand1$price9[brand1$store==store[reg]]),
log(brand1$price10[brand1$store==store[reg]]),
log(brand1$price11[brand1$store==store[reg]]),
brand1$deal[brand1$store==store[reg]],
brand1$feat[brand1$store==store[reg]] )
regdata[[reg]] = list(y=y, X=X)
}
## storedemo is standardized to zero mean.
Z = as.matrix(orangeJuice$storedemo[,2:12])
dmean = apply(Z, 2, mean)
for (s in 1:nreg) {Z[s,] = Z[s,] - dmean}
iotaz = c(rep(1,nrow(Z)))
Z = cbind(iotaz, Z)
nz = ncol(Z)
Data = list(regdata=regdata, Z=Z)
Mcmc = list(R=R, keep=1)
out = rhierLinearModel(Data=Data, Mcmc=Mcmc)
summary(out$Deltadraw)
summary(out$Vbetadraw)
## plotting examples
if(0){ plot(out$betadraw) }
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.