# st: Re: predict using a subset of X

 From "Michael Blasnik" <[email protected]> To <[email protected]> Subject st: Re: predict using a subset of X Date Sun, 13 Jun 2004 19:23:33 -0400

```It's not clear what you mean here...you say you want to generate
E[y|x1,...,x50], but that would be the result from -predict- after
running -reg y x1...x50-, not running the model you show.  What would you
want predict to do about the fact that there are 50 other terms in the model
that you don't want in the prediction?  There is generally no reason to
think the predictions will have much to do with E[y].

If you just want an Xb prediction with only a subset of b, you could copy
e(b) to a matrix, create a submatrix with only the terms you want (do you
want the constant?), and then use matrix score to have Stata calculate the
"prediction".

reg y x1...x100
mat b=e(b)
mat b=b[1,1..50]
mat score mypredict=b

mypredict will contain the prediction from the first 50 terms, but won't
include the remain 50 xs or the constant (which Stata puts last).

Michael Blasnik
[email protected]

----- Original Message -----
From: "Dimitriy V. Masterov" <[email protected]>
To: <[email protected]>
Sent: Sunday, June 13, 2004 6:57 PM
Subject: st: predict using a subset of X

> Is it possible to automatically generate a yhat for a subset of the RHS
> variables?
>
> Let's say I run a regression:
>
> reg y x1 x2 .... x100
>
> I want to generate
> yhat=E[y | x1,...,x50]
> rather than
> yhat=E[y|x1,...,x100]
>
> Is there some option like predict yhat, for(x1-x50)?
>
> DVM
>
>
____________________________________________________________________________
___
> Dimitriy V. Masterov
>
> Work:
> Center for Social Program Evaluation
> 1155 East 60th St. Room 038
> Chicago, IL 60637
> Work: (773)256-6005
> Fax: (773)256-6313
>
> Home:
> 1312 East 53rd St., Apt.309
> Chicago, IL 60615
> Mobile: (773)220-2760

*
*   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/
```