Scotch {bayesm}R Documentation

Survey Data on Brands of Scotch Consumed

Description

from Simmons Survey. Brands used in last year for those respondents who report consuming scotch.

Usage

data(Scotch)

Format

A data frame with 2218 observations on the following 21 variables. All variables are coded 1 if consumed in last year, 0 if not.

Chivas.Regal
a numeric vector
Dewar.s.White.Label
a numeric vector
Johnnie.Walker.Black.Label
a numeric vector
J...B
a numeric vector
Johnnie.Walker.Red.Label
a numeric vector
Other.Brands
a numeric vector
Glenlivet
a numeric vector
Cutty.Sark
a numeric vector
Glenfiddich
a numeric vector
Pinch..Haig.
a numeric vector
Clan.MacGregor
a numeric vector
Ballantine
a numeric vector
Macallan
a numeric vector
Passport
a numeric vector
Black...White
a numeric vector
Scoresby.Rare
a numeric vector
Grants
a numeric vector
Ushers
a numeric vector
White.Horse
a numeric vector
Knockando
a numeric vector
the.Singleton
a numeric vector

Source

Edwards, Y. and G. Allenby (2003), "Multivariate Analysis of Multiple Response Data," JMR 40, 321-334.

References

Chapter 4, Bayesian Statistics and Marketing by Rossi et al.
http://gsbwww.uchicago.edu/fac/peter.rossi/research/bsm.html

Examples

data(Scotch)
cat(" Frequencies of Brands", fill=TRUE)
mat=apply(as.matrix(Scotch),2,mean)
print(mat)
##
## use Scotch data to run Multivariate Probit Model
##
if(nchar(Sys.getenv("LONG_TEST")) != 0){
##

y=as.matrix(Scotch)
p=ncol(y); n=nrow(y)
dimnames(y)=NULL
y=as.vector(t(y))
y=as.integer(y)
I_p=diag(p)
X=rep(I_p,n)
X=matrix(X,nrow=p)
X=t(X)

R=2000
Data=list(p=p,X=X,y=y)
Mcmc=list(R=R)
set.seed(66)
out=rmvpGibbs(Data=Data,Mcmc=Mcmc)

ind=(0:(p-1))*p + (1:p)
cat(" Betadraws ",fill=TRUE)
mat=apply(out$betadraw/sqrt(out$sigmadraw[,ind]),2,quantile,probs=c(.01,.05,.5,.95,.99))
print(mat)
rdraw=matrix(double((R)*p*p),ncol=p*p)
rdraw=t(apply(out$sigmadraw,1,nmat))
cat(" Draws of Correlation Matrix ",fill=TRUE)
mat=apply(rdraw,2,quantile,probs=c(.01,.05,.5,.95,.99))
## correlation matrix too large to print -- summarize
quantile(round(mat,digits=2))

}


[Package bayesm version 2.0-8 Index]