Statalist The Stata Listserver


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

st: RE: RE: RE: RE: local variables program


From   "Nachbar, Dirk" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: RE: local variables program
Date   Mon, 25 Jun 2007 14:22:57 +0100

Thanks to all. The programs works now. In case you are interested, see
below. This is basically a threshold demand model.

global minRMSE=999999999999999999
sum  avgunitprice if id==8, detail
global min=r(p5)
global max=r(p95)
forval i = 1(2)100 {
  scalar j = $min + `i' * ($max - $min) / 100
  cap drop below* above*
  gen below = avgunitprice < j
  gen belowprice = avgunitprice * below
  gen above = avgunitprice >= j
  gen aboveprice = avgunitprice * above
  qui reg lunit below belowprice above aboveprice if id==8, nocons
  if e(rmse) < $minRMSE {
    global minRMSE = e(rmse)
	di j
    reg lunit below belowprice above aboveprice if id==8, nocons
	  
  }
}

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