Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: How to graph predictions after estimation with multiple equations


From   "Eva Poen" <[email protected]>
To   Statalist <[email protected]>
Subject   st: How to graph predictions after estimation with multiple equations
Date   Thu, 26 Jun 2008 15:16:18 +0100

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index