Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72762

Generating and storing multiple estimates sequentially

$
0
0
I have a dataset on buyers and sellers and their transactions for multiple years. It looks like the following:


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(Transaction Buyer Seller) str4 Year
 121 1 2 "1979"
 342 1 3 "1979"
 342 1 4 "1979"
  55 2 1 "1979"
 443 2 3 "1979"
2324 2 4 "1979"
 324 3 1 "1979"
  55 3 2 "1979"
 334 3 4 "1979"
  55 4 1 "1979"
  33 4 2 "1979"
  22 4 3 "1979"
   . . . ".."  
   . . . "."  
   . . . "."  
   . . . "."  
   . . . ""    
   . . . ""    
 213 1 2 "1995"
2141 1 3 "1995"
   . . . "."  
end

I want to estimate regressions of the form:

Code:
xi: regress Transactions i.Buyer i.Seller

for each year, while storing the estimates (preferably in a common file).

As of now, I am running regressions of the following type:

Code:
parmby " regress Transactions i.Buyer i.Seller ,label norestore
Short of manually doing this year by year and storing estimates, I am thinking of doing something of the form:

Code:
levelsof year, local(i)

foreach j of local i {
parmby " xi: regress Transactions i.Buyer i.Seller ,label norestore
}
and adding a command from the estimates store class of commands.
How can I save the estimates to the same external file, where the estimates from each regression corresponding to different years are matched by the variable names.
This way cannot work, because once I use parmby, the entire original dataset is deleted, and I will be unable to run multiple regressions. Any help is much appreciated.

Viewing all articles
Browse latest Browse all 72762

Trending Articles