Figure 3: Estimated posterior densities of m for the sliced cheese example. ( y$_{it}$ ), weekly counts of sales visits from representatives of the drug manufacturer ( x$_{it}$ ), and some time-invariant demographic information ( z$_{i}$ ). Although one could model the purchase data as conditional on the sales visits, Manchanda et al. argue that the rate of these contacts is determined endogenously, so that physicians who are expected to write more prescriptions, or who are more responsive to the sales visits, will receive visits more often. In this model, y$_{it}$ is a random variable that follows a negative binomial distribution with shape r and mean m $_{it}$, and x$_{it}$ is a Poisson-distributed random variable with mean h $_{i}$. The expected number of prescriptions per week depends in the number of sales visits, so we let log m $_{it}$= b i $_{0}$+ b i $_{1}$x$_{it}$ , where b i is a vector of heterogeneous coefficients. We then model the contact rate so it depends on the physician-specific propensities to purchase, so log h $_{i}$= g $_{0}$+$_{g}$$_{1}$$_{b}$$_{i}$$_{0}$ +$_{g}$$_{2}$$_{b}$$_{i}$$_{1}$ . Define z$_{i}$ as a vector of four physician-specific demographics (including an intercept), and define D as a 2 × 4 matrix of population-level coefficients. The mixing distribution for b (i.e., the prior on each b $_{i}$), is MVN with mean D $^{′}$z$_{i}$ and covariance V . We place weakly informative MVN priors on g and the rows of D , an inverse Wishart prior on V , and a gamma prior on r . There are 2,015 distinct parameters to be estimated. This model differs slightly from the one in Manchanda et al. (2004) only in that h i depends only on expected sales in the current period, and not the long-term trend. We made this change to make it easier to run the baseline MCMC algorithm. As before, our baseline estimation algorithm is HMC, but instead of using Stan, we use the “double averaging” method to adaptively scale the step size (Hoffman and Gelman 2014), and 15 M 1000 M 10000 M 50000 stan 3.00 3.25 3.50 3.75 4.00 −2.50 −2.25 −2.00 −1.75 0.8 1.0 1.2 1 2 3 1.14 1.20 1.28 1.14 1.20 1.28 1.14 1.20 1.28 stan scale factor on Hessian value