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: Looping and saving regression outputs


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: Looping and saving regression outputs
Date   Thu, 17 May 2012 18:37:07 +0100

I think it's the other way round. What you are doing precisely is unclear and more detailed advice is difficult for that reason. 

For example: 

You refer to cycling over variables -sizef- but it is not clear where -sizef- appears in your code. 

You say you have 51,000 variables, but no Stata allows more than 32,767 variables. Do you mean observations?  

Ada's very helpful reply is about as detailed as you can expect until you clarify such details. 

For "STATA" read "Stata". 

Nick 
[email protected] 

Sebastian Galarza

Ada Ma et al, 

Thank you for your response. Can you be a little bit more explicit in the coding of this? I am still far from being a STATA power user and some examples might be helpful. Im looking into the svmat command and its a good starting point. Thanks for your input, 

On May 17, 2012, at 8:15 AM, Ada Ma wrote:

> First you can create one matrix for each regression by stacking the r2
> on to the coefficients.  So say you have Q explanatory variable your
> row matrix would be 1 x (Q+1+1) (one for the constant one for the r2).
>  You might also consider adding the SEs to your matrix too.  You might
> want to add an extra item at the top end of your matrix to label your
> regressions too to save your effort.
> 
> Then you can stack all the regression results into one big matrix.
> 
> Then after you have done all the loopings use -svmat- to turn your big
> matrix into variables.
> 
> Then finally you -outsheet- those variables into a CSV or save the new
> variables as a separate Stata dataset.

 
On Wed, May 16, 2012 at 6:22 PM, Sebastian Galarza
 
>> I want to run the following code and save the beta values and r2 for three different regressions in a matrix such as this:
>> 
>> Variable B0a B1a B2a R2a B1b B2b B3b R2b B1c B2c B3c R2c
>> 1
>> 2
>> 3
>> 
>> I have a total of 51000 variables (sizef) so that the code I would like to run is:
>> 
>> 
>> *for each variable sizef
>> 
>> nl (P_WOR = {b0=0.1}*(1 * exp({b1=0.05}* (ageyear))))
>> predict a
>> matrix list e(b)
>> display e(r2)
>> 
>> * save beta values and r2
>> 
>> nl log3: P_WOR ageyear
>> predict b
>> matrix list e(b)
>> display e(r2)
>> 
>> * save beta values and r2
>> 
>> nl gom3: P_WOR ageyear
>> predict c
>> matrix list e(b)
>> display e(r2)
>> 
>> * save beta values and r2
>> 
>> Any help would be greatly appreciated.

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


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