Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: reading in 150 stored regression models from csv file, one at a time and using predict ... ?


From   Alexander Nervedi <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: reading in 150 stored regression models from csv file, one at a time and using predict ... ?
Date   Sat, 23 Nov 2013 08:45:15 +0000

Thanks Fernando, this is a useful thought to build on.


----------------------------------------
> Date: Fri, 22 Nov 2013 16:35:32 -0600
> Subject: Re: st: reading in 150 stored regression models from csv file, one at a time and using predict ... ?
> From: [email protected]
> To: [email protected]
>
> Hi Alex,
>
> There may be other ways of doing this, but if you back up one step and
> start from your data, you could write a loop that does the reg and
> predict for each commodity. A quick example below, though I have not
> tested this.
>
> local i=1
> while `i' < 206 {
> reg y x1 x2 x3 x4 x5 if group==`i'
> predict yhat_`i', xb
> local i = `i' + 1
> }
>
> Not sure if that code would run as is, but you get the idea. You
> wanted to start from the coefficients, so this doesn't really answer
> your question directly but is a viable alternative. Good luck!
>
> Fernando
>
> On Fri, Nov 22, 2013 at 12:46 PM, Alexander Nervedi
> <[email protected]> wrote:
>> Hi Stata-masters,
>>
>> I have transactions data on 205 different commodity groups, and have estimated simple OLS models for hedonic prices each of these groups - simple reg y x1 x2 x3 x4 x5, where y is prices and x1, ... x5 are attributes of the commodities. I have stored these models in coef.csv using parmby and outsheet. Now i would like to read in the regressions from each of the these 205 models, and try to figure out what the prices would have been across each of the 205 categories if the structural relationship looked like it does for commodity group `j' where `j' takes on values from 1 to 205.
>>
>> I need to read in the coefs and run predict for the entire sample one set of coefs a time - but how do i get that to happen since predict doesn't work unless an ols command has been run ...
>>
>> thanks,
>>
>> Alex
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index