Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: re: list X matrix

 From richard boylan To statalist@hsphsun2.harvard.edu Subject Re: st: re: list X matrix Date Mon, 29 Mar 2010 14:18:10 -0500

```No, the prediction is based on the additional variable "z." So, I
cannot use the predict command.

Not to seem overly mysterious, I was trying not to add additional
details. I am used an old procedure to estimate SUR with AR(1) error
components.

I start estimating a system

y1 = X b1 + u1
y2 = X b2 + u2
y3 = X b2 + u3

Then, I run a system of regressions of the form

u1 = rho11 u1_{t-1} + r12 u2_{t-1} + r13 u3_{t-1}
u2 = rho u2_{t-1} + ...
u3 = rho u3_{t-1} + ...

to estimate the rhos.

Then, I estimate by SUR

(y1 - rho11 y1,t-1 - rho12 y2,t-1 - rho13 y3,t-1) = (x1 - r11 x_t-1)
bi +  x_t-1 a_1
y2 - ....
y3 - ...

where I have some restrictions between the bi and ai.

So, at this stage, STATA will give me an R^2, but it is based on this
additional variables that are used to control for the AR(1)
and correlation among regressions.  So, this is why I do not want to
use this R^2 or these predicted values, but instead use
the estimated (b1,b2,b3) and plug it back into the original regression.

This is probably way too much detail, just wanted to make the point
the relation between correlation and R^2.

On Mon, Mar 29, 2010 at 1:23 PM, Christopher Baum <Baum@bc.edu> wrote:
> <>
> Thanks but the question was not on how to compute the R^2 but on how
> to compute Xb,
> so the Statlist FAQ would not have helped.
>
> On Mon, Mar 29, 2010 at 6:29 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
>> The approach that Kit recommends is spelled out at greater length in
>>
>> FAQ     . . . . . . . . . . . . . . . . . . . . . . . Do-it-yourself
>> R-squared
>>        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N.
>> J. Cox
>>        9/03    How can I get an R-squared value when a Stata command
>>                does not supply one?
>>                http://www.stata.com/support/faqs/stat/rsquared.html
>>
>> The Statalist FAQ does draw attention to the FAQs as a way of answering
>> many questions. -search- does search the FAQs as well.
>>
>> Nick
>> n.j.cox@durham.ac.uk
>>
>> Kit Baum replied to Richard Boylan
>>
>> Richard Boylan
>> ==============
>>
>> The problem was as follows.
>>
>> The regression is y = x b + e. (1)
>>
>> However, to estimate it (b/c of a variety of issues such
>> autocorrelation, system of equation with correlated errors), the model
>> that I end up estimating is
>>
>> yt = xt b + z c + v, (2)
>>
>> where yt is a transformation of y, xt is a transformation of x, and z
>> are variables from the other regressions.
>>
>> So, what I need to do is to get the estimates of b from (2) and plug
>> back into (1) to compute my R^2.
>>
>> Kit Baum
>> ========
>>
>> An R^2 measure for any model can almost always be computed from the
>> simple correlation between Y and Yhat, so if you can construct a
>> predicted value from the equation you estimate "if e(sample)" for yt,
>> and apply the inverse transformation that gets you back to yhat, just
>> compute the square of that correlation.
>>
>>
>
>
> But you said you estimated (2). If you estimated it with Stata, the command almost surely has a predict option. The predictions of yt are related to the predictions of y by the inverse transformation. So use predict after estimating (2) to compute yt-hats, transform them back to y space. You then have yhats.
>
> You did say you wanted to compute an R^2, and this is how to do it. Compute the squared correlation of y and yhat.
>
> Kit Baum   |   Boston College Economics and DIW Berlin   |   http://ideas.repec.org/e/pba1.html
> An Introduction to Stata Programming   |   http://www.stata-press.com/books/isp.html
> An Introduction to Modern Econometrics Using Stata   |   http://www.stata-press.com/books/imeus.html
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```