# Re: st: How to graph predictions after estimation with multiple equations

 From "Austin Nichols" To statalist@hsphsun2.harvard.edu Subject Re: st: How to graph predictions after estimation with multiple equations Date Thu, 26 Jun 2008 10:44:10 -0400

```Eva--
If you already have a prediction command, just create a copy of the
data with fake obs with the values from M for all but one of the
predictors, but actual values for the regressor of interest, or some
range of evenly spaced values if you prefer, then predict (out of
sample) and graph, then delete the fake obs.

On Thu, Jun 26, 2008 at 10:16 AM, Eva Poen <eva.poen@gmail.com> wrote:
> Dear all,
>
> I have implemented an estimator for a mixed model consisting of three
> equations, via -ml- with method -lf-. I made an estimation command
> from it, and I also wrote a prediction command so that -mfx- can do
> its job.
>
> What I want to do now is plot the prediction from the model versus one
> of the predictors, with given values for the other predictors. In an
> ideal world, I'd have a program doing this which accepts a matrix
> (let's call it M) containing the values of the predictors. The
> prediction is a complicated function involving all three equations.
>
> Now, the first problem that came up was the fact that the matrix e(b)
> after estimation has all three equations stacked on top of each other.
> As an aggravating factor, the set of predictors in the three equations
> are not necessarily the same. I am now looking for an easy way to
>
> a) "unstack" e(b) such that I have one matrix for each equation (b1,
> b2 and b3). I'm not sure how to do this without manual intervention
> when the number of predictors differ between equations.
>
> b)  match coefficients in b1, b2 and b3 with elements of M by name
> (row name or column name). Each element of M may appear in 1, 2, or
> all 3 equations. I need to compute xb1, xb2 and xb3 from the set of 4
> matrices.
>
> I'd be grateful for any hints on how to do this. Maybe there is an
> altogether much simpler approach to the task?
>
> Thanks,
> Eva
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```