Learn R Programming

bayesm (version 2.2-1)

orangeJuice: Store-level Panel Data on Orange Juice Sales

Description

yx, weekly sales of refrigerated orange juice at 83 stores. storedemo, contains demographic information on those stores.

Usage

data(orangeJuice)

Arguments

format

This R object is a list of two data frames, list(yx,storedemo). List of 2 $ yx :'data.frame': 106139 obs. of 19 variables: ...$ store : int [1:106139] 2 2 2 2 2 2 2 2 2 2 ...$ brand : int [1:106139] 1 1 1 1 1 1 1 1 1 1 ...$ week : int [1:106139] 40 46 47 48 50 51 52 53 54 57 ...$ logmove : num [1:106139] 9.02 8.72 8.25 8.99 9.09 ...$ constant: int [1:106139] 1 1 1 1 1 1 1 1 1 1 ...$ price1 : num [1:106139] 0.0605 0.0605 0.0605 0.0605 0.0605 ...$ price2 : num [1:106139] 0.0605 0.0603 0.0603 0.0603 0.0603 ...$ price3 : num [1:106139] 0.0420 0.0452 0.0452 0.0498 0.0436 ...$ price4 : num [1:106139] 0.0295 0.0467 0.0467 0.0373 0.0311 ...$ price5 : num [1:106139] 0.0495 0.0495 0.0373 0.0495 0.0495 ...$ price6 : num [1:106139] 0.0530 0.0478 0.0530 0.0530 0.0530 ...$ price7 : num [1:106139] 0.0389 0.0458 0.0458 0.0458 0.0466 ...$ price8 : num [1:106139] 0.0414 0.0280 0.0414 0.0414 0.0414 ...$ price9 : num [1:106139] 0.0289 0.0430 0.0481 0.0423 0.0423 ...$ price10 : num [1:106139] 0.0248 0.0420 0.0327 0.0327 0.0327 ...$ price11 : num [1:106139] 0.0390 0.0390 0.0390 0.0390 0.0382 ...$ deal : int [1:106139] 1 0 0 0 0 0 1 1 1 1 ...$ feat : num [1:106139] 0 0 0 0 0 0 0 0 0 0 ...$ profit : num [1:106139] 38.0 30.1 30.0 29.9 29.9 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. $ storedemo:'data.frame': 83 obs. of 12 variables: ...$ STORE : int [1:83] 2 5 8 9 12 14 18 21 28 32 ...$ AGE60 : num [1:83] 0.233 0.117 0.252 0.269 0.178 ...$ EDUC : num [1:83] 0.2489 0.3212 0.0952 0.2222 0.2534 ...$ ETHNIC : num [1:83] 0.1143 0.0539 0.0352 0.0326 0.3807 ...$ INCOME : num [1:83] 10.6 10.9 10.6 10.8 10.0 ...$ HHLARGE : num [1:83] 0.1040 0.1031 0.1317 0.0968 0.0572 ...$ WORKWOM : num [1:83] 0.304 0.411 0.283 0.359 0.391 ...$ HVAL150 : num [1:83] 0.4639 0.5359 0.0542 0.5057 0.3866 ...$ SSTRDIST: num [1:83] 2.11 3.80 2.64 1.10 9.20 ...$ SSTRVOL : num [1:83] 1.143 0.682 1.500 0.667 1.111 ...$ CPDIST5 : num [1:83] 1.93 1.60 2.91 1.82 0.84 ...$ CPWVOL5 : num [1:83] 0.377 0.736 0.641 0.441 0.106

source

Alan L. Montgomery (1997), "Creating Micro-Marketing Pricing Strategies Using Supermarket Scanner Data," Marketing Science 16(4) 315-337.

Details

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

References

Chapter 5, Bayesian Statistics and Marketing by Rossi et al. http://faculty.chicagogsb.edu/peter.rossi/research/bsm.html

Examples

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


## Example 2 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)

if(0){
## plotting examples
plot(out$betadraw)
}
}

Run the code above in your browser using DataLab