| ![]() |
From | "Michael Blasnik" <michael.blasnik@verizon.net> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: Re: RE: RE: RE: local variables program |
Date | Mon, 25 Jun 2007 09:06:11 -0400 |
How about this.... (edited lines commented out; some lines reordered)
global maxRMSE=999999999999999999
sum avgunitprice if id==5, detail
global min=r(p5)
global max=r(p95)
*forval i= 1 2 100 {
forval i = 1(2)100 {
scalar j = $min + `i' * ($max - $min) / 100
* gen belowprice=avgunitprice*(avgunitprice<`j')
gen below = avgunitprice < `j'
gen belowprice = avgunitprice * below
* gen aboveprice=avgunitprice*(avgunitprice>=`j')
gen above = avgunitprice >= `j'
gen aboveprice = avgunitprice * above
qui reg lunit below belowprice above aboveprice if id==5, nocons
if e(rmse) < $maxRMSE {
* local $maxRMSE=e(rmse)
global maxRMSE = e(rmse)
reg lunit below belowprice above aboveprice
}
* cap drop below belowprice aboveprice above j
cap drop below belowprice aboveprice above
}
di $maxRMSE
-----------------------------------
Thomas J. Steichen
steicht@rjrt.com
-----------------------------------
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nachbar, Dirk
Sent: Monday, June 25, 2007 6:21 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: RE: local variables program
Thanks Maarten
* * 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–2025 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |