bank                 package:bayesm                 R Documentation

_B_a_n_k _C_a_r_d _C_o_n_j_o_i_n_t _D_a_t_a _o_f _A_l_l_e_n_b_y _a_n_d _G_i_n_t_e_r (_1_9_9_5)

_D_e_s_c_r_i_p_t_i_o_n:

     Data from a conjoint experiment in which two partial profiles of 
     credit cards were presented to 946 respondents. The variable 
     bank$choiceAtt$choice indicates which profile was chosen.  The
     profiles are coded as the difference in attribute levels. Thus, a
     "-1" means the profile coded as a choice of "0" has the attribute.
     A value of 0 means that the attribute was not present in the 
     comparison.

     data on age,income and gender (female=1) are also recorded in 
     bank$demo

_U_s_a_g_e:

     data(bank)

_F_o_r_m_a_t:

     This R object is a list of two data frames, list(choiceAtt,demo).

     List of 2 

     $ choiceAtt:`data.frame':     14799 obs. of  16 variables:
      ...$ id           : int [1:14799] 1 1 1 1 1 1 1 1 1 1 
      ...$ choice       : int [1:14799] 1 1 1 1 1 1 1 1 0 1 
      ...$ Med_FInt     : int [1:14799] 1 1 1 0 0 0 0 0 0 0 
      ...$ Low_FInt     : int [1:14799] 0 0 0 0 0 0 0 0 0 0 
      ...$ Med_VInt     : int [1:14799] 0 0 0 0 0 0 0 0 0 0 
      ...$ Rewrd_2      : int [1:14799] -1 1 0 0 0 0 0 1 -1 0 
      ...$ Rewrd_3      : int [1:14799] 0 -1 1 0 0 0 0 0 1 -1 
      ...$ Rewrd_4      : int [1:14799] 0 0 -1 0 0 0 0 0 0 1 
      ...$ Med_Fee      : int [1:14799] 0 0 0 1 1 -1 -1 0 0 0 
      ...$ Low_Fee      : int [1:14799] 0 0 0 0 0 1 1 0 0 0 
      ...$ Bank_B       : int [1:14799] 0 0 0 -1 1 -1 1 0 0 0 
      ...$ Out_State    : int [1:14799] 0 0 0 0 -1 0 -1 0 0 0 
      ...$ Med_Rebate   : int [1:14799] 0 0 0 0 0 0 0 0 0 0 
      ...$ High_Rebate  : int [1:14799] 0 0 0 0 0 0 0 0 0 0 
      ...$ High_CredLine: int [1:14799] 0 0 0 0 0 0 0 -1 -1 -1 
      ...$ Long_Grace   : int [1:14799] 0 0 0 0 0 0 0 0 0 0 

     $ demo     :`data.frame':     946 obs. of  4 variables:
      ...$ id    : int [1:946] 1 2 3 4 6 7 8 9 10 11 
      ...$ age   : int [1:946] 60 40 75 40 30 30 50 50 50 40 
      ...$ income: int [1:946] 20 40 30 40 30 60 50 100 50 40 
      ...$ gender: int [1:946] 1 1 0 0 0 0 1 0 0 0 

_D_e_t_a_i_l_s:

     Each respondent was presented with between 13 and 17 paired
     comparisons. Thus, this dataset has a panel structure.

_S_o_u_r_c_e:

     Allenby and Ginter (1995), "Using Extremes to Design Products and
     Segment Markets," _JMR_, 392-403.

_R_e_f_e_r_e_n_c_e_s:

     Appendix A, _Bayesian Statistics and Marketing_ by Rossi,Allenby
     and McCulloch. 
      <URL:
     http://gsbwww.uchicago.edu/fac/peter.rossi/research/bsm.html>

_E_x_a_m_p_l_e_s:

     data(bank)
     cat(" table of Binary Dep Var", fill=TRUE)
     print(table(bank$choiceAtt[,2]))
     cat(" table of Attribute Variables",fill=TRUE)
     mat=apply(as.matrix(bank$choiceAtt[,3:16]),2,table)
     print(mat)
     cat(" means of Demographic Variables",fill=TRUE)
     mat=apply(as.matrix(bank$demo[,2:3]),2,mean)
     print(mat)

     ## example of processing for use with rhierBinLogit
     ##
     if(nchar(Sys.getenv("LONG_TEST")) != 0)
     {
     choiceAtt=bank$choiceAtt
     Z=bank$demo

     ## center demo data so that mean of random-effects
     ## distribution can be interpretted as the average respondents

     Z[,1]=rep(1,nrow(Z))
     Z[,2]=Z[,2]-mean(Z[,2])
     Z[,3]=Z[,3]-mean(Z[,3])
     Z[,4]=Z[,4]-mean(Z[,4])
     Z=as.matrix(Z)

     hh=levels(factor(choiceAtt$id))
     nhh=length(hh)
     lgtdata=NULL
     for (i in 1:nhh) {
             y=choiceAtt[choiceAtt[,1]==hh[i],2]
             nobs=length(y)
             X=as.matrix(choiceAtt[choiceAtt[,1]==hh[i],c(3:16)])
             lgtdata[[i]]=list(y=y,X=X)
                     }

     cat("Finished Reading data",fill=TRUE)
     fsh()

     Data=list(lgtdata=lgtdata,Z=Z)
     Mcmc=list(R=10000,sbeta=0.2,keep=20)
     set.seed(66)
     out=rhierBinLogit(Data=Data,Mcmc=Mcmc)

     cat(" Deltadraws ",fill=TRUE)
     mat=apply(out$Deltadraw,2,quantile,probs=c(.01,.05,.5,.95,.99))
     print(mat)
     cat(" Vbetadraws ",fill=TRUE)
     mat=apply(out$Vbetadraw,2,quantile,probs=c(.01,.05,.5,.95,.99))
     print(mat)
     }

