Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: predict using a subset of X


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
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
michael.blasnik@verizon.net


----- Original Message ----- 
From: "Dimitriy V. Masterov" <dvmaster@lily.src.uchicago.edu>
To: <statalist@hsphsun2.harvard.edu>
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/



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