Statalist The Stata Listserver


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

Re: st: Saving STREG results


From   "Ben Jann" <[email protected]>
To   [email protected]
Subject   Re: st: Saving STREG results
Date   Tue, 22 May 2007 21:41:26 +0200

Try the -estwrite- package. -estwrite- can be used to store the models
on disk from where they can be restored later.  -estwrite- requires
-estsave-. Both are available from the SSC Archive:

. ssc install estsave
. ssc install estwrite

ben

On 5/22/07, Jon Haveman <[email protected]> wrote:
Hi Statalisters,
This is my first post, so my apologies if I violate protocol.

I am writing with a question similar to Alessia's.  That is, it has to do
with out of sample forecasting.  In my case, I am performing a duration
analysis of subprime loans, trying to assess foreclosures in the future.

My sample sizes are very large and streg takes some time to complete.  For
now, every time I change the sample for which I want to forecast future
foreclosures, I have to rerun streg.  This is very time consuming.

I'm wondering if there is a way that I can store the streg output parameters
in such a way that I can easily read them back in as though I had just
performed an "est restore a"  (where a is now created with "est store a").

I'd like to uncouple the program that does the forecasting from the program
that does the estimation.

I have been informed of parmby, but this does not seem to do quite what I
want.  If I understand in the results of the parmby command, they are their
own stata dataset and I lose the data from which I would like to forecast.

I appreciate any assistance that people can provide.

Thanks in advance.

Jon

-----Original Message-----
From: Richard Williams [mailto:[email protected]]
Sent: Tuesday, May 22, 2007 8:45 AM
To: [email protected]
Subject: Re: st: predicting y, with other variables

At 09:28 AM 5/22/2007, alessia matano wrote:
>Hi,
>
>I hope some of you can help me...
>I estimate a regression and I saved the coefficients e(b) in the
>corresponding matrix. Now I would like to apply these coefficients
>estimates to the same set of x's variables, but for one that I want to
>substitute with another and calculate the predicted values (to see
>which is the variation in the rpedicted values using this other
>variables). Anyone of you knows how to do this?
>I tried creating a matrix with the new x's variables, but my n=2400
>and so the matsize set does not allow me to create such a matrix.
>
>Thank you very much for your help.
>Regards
>alessia

I'm not totally sure I understand you alessia.  Is the idea that you
want to do something like

reg y x1 x2 x3

but then substitute x4 for x3 when computing predicted values?  If
so, try something like

clonevar tmpvar = x3
reg y x1 x2 tmpvar
predict yhat1
drop tmpvar
clonevar tmpvar = x4
predict yhat2


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  [email protected]
WWW:    http://www.nd.edu/~rwilliam

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

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

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