starplotModelBased          package:Ratings          R Documentation

_M_o_d_e_l-_b_a_s_e_d _S_t_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 starplot described in Ho and Quinn (n.d.).

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

     starplotModelBased(tau.mat, colvec = NULL, starsize = 0.2, 
                        interpolation.level = 200, ...)

_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. 

  colvec: Vector of rgb colors used for the plot. 

starsize: Positive scalar that regulates the size of the stars in the
          plot.  

interpolation.level: Regulates the smoothness of the color scale.
          'interpolation.level = 1' simply uses the colors in 'colvec'.
          Values of 'interpolation.level > 1' provide increasing
          amounts of interpolation between the values in 'colvec'.
          Larger values of 'interpolation.leve' produce smoother
          transitions between colors. 

     ...: 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', 'barplotModelBased'

_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))

     starplotModelBased(tau.sub)

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

     starplotModelBased(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))

     starplotModelBased(tau.sub)

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

     starplotModelBased(tau.sub)

     ## a different color scheme
     mycol <- rgb(red=c(255, 243, 231, 219, 207, 159, 82.5, 30, 0, 0, 255),
                   green=c(255.0, 250.1, 245.2, 240.3, 235.4, 215.8, 175, 144,
                     0, 0, 69),
                   blue=c(255, 255, 255, 255, 255, 255, 255, 255, 238, 183, 0),
                   maxColorValue=255
                   )

     starplotModelBased(tau.sub, colvec=mycol)

     ## End(Not run)

