interaction plots

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
ginamartin
Posts: 7
Joined: Thu Nov 03, 2016 12:06 pm

interaction plots

Post by ginamartin »

Hello,
I am attempting to plot a cross-level continuous variable x continuous variable interaction from a logistic regression using runmlwin MCMC. I have found the examples very useful at: http://www.bristol.ac.uk/cmm/software/r ... /examples/ particularly http://www.bristol.ac.uk/cmm/media/runmlwin/7.6.do however, I cannot find an example for an interaction with two continuous variables. In the past I have used the margins command but I know this isn't available for runmlwin. Any suggestions would be appreciated.

Thanks,
Gina
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: interaction plots

Post by GeorgeLeckie »

Dear Gina,

Yes you are right, -margins- is not allowed after runmlwin. You will have to generate your plot from first principles. Essentially mucking around with the regression coefficients and some fictitious co-variate data.

So something like this where x1 and x2 are your continuous predictors and where you want to do a plot of the predicted y against x1 separately for three separate values of x2 (-1, 0 and 1)...

generate ylo = _b[cons] + _b[x1]*x1 + _b[x2]*-1 + _b[x1x2]*x1*-1
generate yav = _b[cons] + _b[x1]*x1 + _b[x2]*0 + _b[x1x2]*x1*0
generate yhi = _b[cons] + _b[x1]*x1 + _b[x2]*1 + _b[x1x2]*x1*1

line ylo yav yhi x1

Best wishes

George
Post Reply