barplotModelBased          package:Ratings          R Documentation

_M_o_d_e_l-_b_a_s_e_d _B_a_r_p_l_o_t_s _o_f _R_a_t_i_n_g_s _D_a_t_a

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

     Creates the model-based barplot described in Ho and Quinn (n.d.).

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

     barplotModelBased(tau.mat, barcol = "darkgray", top.limit = 0.5, 
                       scale.factor = 1, ...)

_A_r_g_u_m_e_n_t_s:

 tau.mat: A P x C matrix where P is the number of products being rated
          and C is the number of rating categories. The pth row, cth
          column of 'tau.mat' should give the probability that product
          p is equal to category c. 

  barcol: The color for the bars in the barplot. 

top.limit: The maximum value of the y axis. Should be between 0 and 1. 

scale.factor: Scaling factor that adjusts the scaling of the y axis.
          Any positive value is allowed. 

     ...: Other arguments to plotting functions. 

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

     Ho, Daniel E. and Kevin M. Quinn. forthcoming. "Improving the
     Presentation and Interpretation of Online Ratings Data with
     Model-based Figures." The American Statistician.

_S_e_e _A_l_s_o:

     'ordrating', 'tauCalculate', 'starplotModelBased'

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

     ## Not run: 
     ## Mondo Times example from Ho & Quinn (nd).
     ## may have to increase stack limit to run this example on some machines

     data(Mondo)

     ord.out <- ordrating(Mondo, beta.constraint=1, tune=.035, 
                          ma=1, mb=-5, vinva=1, vinvb=0.05,
                          gamma.start=c(-300, 0, 1.5, 3.0, 4.5, 300),
                          thin=20, burnin=20000, mcmc=100000, verbose=1000)

     ## get rating probabilities
     tau <- tauCalculate(ord.out, 500)

     ## just the labeled outlets
     tau.sub <- tau[-grep("thetaOutlet", rownames(tau)),]

     ## clean up names
     rownames(tau.sub) <-  gsub("theta", "", rownames(tau.sub))

     barplotModelBased(tau.sub)

     ## more informative labels
     colnames(tau.sub) <- c("Awful", "Poor", "Average", "Very Good", "Great")

     barplotModelBased(tau.sub)



     ## subsetting the Mondo data to include only raters who rated 5 or more 
     ## outlets (should avoid any stacksize problems)

     Mondo.sub <- Mondo[apply(!is.na(Mondo), 1, sum) >= 5, ]
     ## also getting rid of outlets that are not rated now
     Mondo.sub <- Mondo.sub[,apply(is.na(Mondo.sub), 2, mean) != 1] 

     ord.out <- ordrating(Mondo.sub, beta.constraint=1, tune=.035, 
                          ma=1, mb=-5, vinva=1, vinvb=0.05,
                          gamma.start=c(-300, 0, 1.5, 3.0, 4.5, 300),
                          thin=20, burnin=20000, mcmc=100000, verbose=1000)

     ## get rating probabilities
     tau <- tauCalculate(ord.out, 500)

     ## just the labeled outlets
     tau.sub <- tau[-grep("thetaOutlet", rownames(tau)),]

     ## clean up names
     rownames(tau.sub) <-  gsub("theta", "", rownames(tau.sub))

     barplotModelBased(tau.sub)

     ## more informative labels
     colnames(tau.sub) <- c("Awful", "Poor", "Average", "Very Good", "Great")

     barplotModelBased(tau.sub)

     ## End(Not run)

