1
$\begingroup$

Suppose I have a regression where the response variable is sales, and I have various drivers of sales as the independent variables. I want to build a model using MCMC but I am unsure if it is even possible ( I am running in SAS). See below for a simplified model structure (there are many more variables and random interactions in the production model):

$$Y_{ij} = \beta_0 + \beta_{1_\text{TV}}X_{1ij} + \gamma_{(\text{TV} \times \text{dma})_{i}} +\varepsilon_{ij}$$

For the model above, I have one main effect for TV represented by $\beta_{1}$ and a random interaction between DMA (there are 210 DMAS in the US) and TV which is represented by gamma. I have priors for all my parameters and when I run MCMC in SAS, it takes hours to run. Can MCMC handle 210 random interaction for the random term? I am using MCMC because I want to utilize the prior knowledge from previous modeling rounds but it makes no sense if it takes forever to run.

  proc mcmc data=modeldbsubset outpost=postout thin=1000 nmc=20000 seed=7893

         monitor=(b0 b1);
  ods select PostSummaries PostIntervals tadpanel;
  parms b0 0 b1 0;
  parms s2 1 ;
  parms s2g 1;
  prior b: ~ normal(0, var = 10000);
  prior s2: ~ igamma(0.001, scale = 1000);
    random gamma ~ normal(0, var=s2g) subject = dmanum monitor = (gamma) namesuffix = position;


  mu = b0 + b1*TV + gamma;

  model Y ~ normal(mu, var = s2);

run;

$\endgroup$
3
  • $\begingroup$ I understand neither the dimensions of the parameter to be simulated and of the actual dataset nor how the SAS code is run, but using Gibbs sampling allows for all the $\gamma_{ij}$'s to be simulated in parallel, conditional on $\beta_0$ and $\beta_1$, all at once. Considering your notations, could $\gamma_{ij}$ and $\epsilon_{ij}$ be integrated into a single noise? $\endgroup$ – Xi'an Jan 2 '19 at 7:48
  • $\begingroup$ @Xi'an The data set has 210 regions x 100 weeks of data so about 21,000 rows of data. I have the sales data and TV spend for each row. Ultimately, I want to estimate a main effect and DMA effect for TV, so that the final coeffcient for each DMA would be TV Main Effect + DMA TV Random Effect. So there would be 210 gammas (random effects) to be estimated, as well as one $ \beta_0$ and one $ \beta_1$ to be estimated. Does that make sense? The problem is that it takes a very long time for one iteration of MCMC to run? Is that due to estimating all the gammas? $\endgroup$ – lord12 Jan 2 '19 at 13:46
  • $\begingroup$ No, even with 212 parameters, standard forms of MCMC like a Gibbs sampler should run much faster for 20,000 iterations. I cannot tell about the SAS version, the last time I looked at a SAS code was in 1983... $\endgroup$ – Xi'an Jan 2 '19 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.