# cheese: Sliced Cheese Data In bayesm: Bayesian Inference for Marketing/Micro-Econometrics

## Description

Panel data with sales volume for a package of Borden Sliced Cheese as well as a measure of display activity and price. Weekly data aggregated to the "key" account or retailer/market level.

## Usage

 `1` ```data(cheese) ```

## Format

A data frame with 5555 observations on the following 4 variables:

 ...`\$RETAILER` a list of 88 retailers ...`\$VOLUME ` unit sales ...`\$DISP ` percent ACV on display (a measure of advertising display activity) ...`\$PRICE ` in U.S. dollars

## Source

Boatwright, Peter, Robert McCulloch, and Peter Rossi (1999), "Account-Level Modeling for Trade Promotion," Journal of the American Statistical Association 94, 1063–1073.

## References

Chapter 3, Bayesian Statistics and Marketing by Rossi, Allenby, and McCulloch.
http://www.perossi.org/home/bsm-1

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49``` ```data(cheese) cat(" Quantiles of the Variables ",fill=TRUE) mat = apply(as.matrix(cheese[,2:4]), 2, quantile) print(mat) ## example of processing for use with rhierLinearModel if(0) { retailer = levels(cheese\$RETAILER) nreg = length(retailer) nvar = 3 regdata = NULL for (reg in 1:nreg) { y = log(cheese\$VOLUME[cheese\$RETAILER==retailer[reg]]) iota = c(rep(1,length(y))) X = cbind(iota, cheese\$DISP[cheese\$RETAILER==retailer[reg]], log(cheese\$PRICE[cheese\$RETAILER==retailer[reg]])) regdata[[reg]] = list(y=y, X=X) } Z = matrix(c(rep(1,nreg)), ncol=1) nz = ncol(Z) ## run each individual regression and store results lscoef = matrix(double(nreg*nvar), ncol=nvar) for (reg in 1:nreg) { coef = lsfit(regdata[[reg]]\$X, regdata[[reg]]\$y, intercept=FALSE)\$coef if (var(regdata[[reg]]\$X[,2])==0) { lscoef[reg,1]=coef lscoef[reg,3]=coef } else {lscoef[reg,]=coef} } R = 2000 Data = list(regdata=regdata, Z=Z) Mcmc = list(R=R, keep=1) set.seed(66) out = rhierLinearModel(Data=Data, Mcmc=Mcmc) cat("Summary of Delta Draws", fill=TRUE) summary(out\$Deltadraw) cat("Summary of Vbeta Draws", fill=TRUE) summary(out\$Vbetadraw) # plot hier coefs if(0) {plot(out\$betadraw)} } ```

### Example output

``` Quantiles of the Variables
VOLUME       DISP    PRICE
0%      231.0 0.00000000 1.319907
25%    1989.5 0.00000000 2.457262
50%    3408.0 0.04736842 2.703250
75%    5519.5 0.16600000 3.203279
100% 148109.0 1.00000000 4.641757
```

bayesm documentation built on Oct. 30, 2019, 9:49 a.m.