Learn R Programming

bayesm (version 3.1-6)

orangeJuice: Store-level Panel Data on Orange Juice Sales

Description

Weekly sales of refrigerated orange juice at 83 stores. Contains demographic information on those stores.

Usage

data(orangeJuice)

Arguments

Format

The orangeJuice object is a list containing two data frames, yx and storedemo.

Details

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:

1Tropicana Premium 64 oz
2Tropicana Premium 96 oz
3Florida's Natural 64 oz
4Tropicana 64 oz
5Minute Maid 64 oz
6Minute Maid 96 oz
7Citrus Hill 64 oz
8Tree Fresh 64 oz
9Florida Gold 64 oz
10Dominicks 64 oz
11Dominicks 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

References

Chapter 5, Bayesian Statistics and Marketing by Rossi, Allenby, and McCulloch.

Examples

Run this code
## 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) }
}

Run the code above in your browser using DataLab