Statalist


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

st: RE: Re: increasing time burden during resampling


From   "Feiveson, Alan H. (JSC-SK311)" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Re: increasing time burden during resampling
Date   Wed, 30 Dec 2009 11:48:29 -0600

Joe - Here's an example using auto.dta. I artificially introduced some "factors".

Al

version 9.0
args NIT 
sysuse auto,clear
gen fac1 = int((_n-1)/10)
gen fac2 = int((length+10*mpg)/100)

forv it=1(1)`NIT' {
timer clear 1
timer on 1
forv i=1(1)21 {
xtreg price fac1##fac2 ,i(foreign) 
lincom _b[2.fac1#4.fac2]
lincom _b[2.fac1#4.fac2]
lincom _b[2.fac1#4.fac2]
lincom _b[2.fac1#4.fac2]
 }
timer off 1
timer list 1
noi di `it',r(t1)
}

. run testtimea 20
1 1.015
2 .938
3 .969
4 .953
5 .984
6 1
7 1.016
8 1.031
9 1.047
10 1.062
11 1.078
12 1.11
13 1.125
14 1.172
15 1.187
16 1.219
17 1.25
18 1.281
19 1.297
20 1.328







-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Joseph Coveney
Sent: Tuesday, December 29, 2009 3:57 PM
To: [email protected]
Subject: st: Re: increasing time burden during resampling

Sorry.  You'd never have been able to see any influence of estimation and
testing amid all of the post file opening and closing in the inner loop; fixed
below.  Still no trend indicating bogging down from -test-, though.

Joseph Coveney


version 11.0
clear *
set more off
sysuse auto

tempname memhold
tempfile tmpfil0


forvalues iterations = 100(200)900 {
	timer clear 1
	timer on 1
	postfile `memhold' int iteration str11 predictor ///
			double p using `tmpfil0', replace
	quietly forvalues iteration = 1/`iterations' {
		regress price c.(mpg headroom trunk weight length ///
			turn displacement gear_ratio) i.(rep78 foreign)
		foreach predictor in mpg headroom trunk weight ///
			length turn displacement gear_ratio {
			test `predictor'
			post `memhold' (`iteration') ("`predictor'") (`r(p)')
		}
	}
	postclose `memhold'
	timer off 1
	display in smcl as text _newline(2) "Iterations: `iterations'"
	timer list 1
	display in smcl as text %4.2f r(t1) / `iterations' * 100  " s / 100"
}

exit


Iterations: 100
   1:      1.94 /        1 =       1.9430
1.94 s / 100


Iterations: 300
   1:      5.77 /        1 =       5.7680
1.92 s / 100


Iterations: 500
   1:      8.98 /        1 =       8.9830
1.80 s / 100


Iterations: 700
   1:     12.69 /        1 =      12.6880
1.81 s / 100


Iterations: 900
   1:     16.14 /        1 =      16.1440
1.79 s / 100

. 
. exit

end of do-file



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

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index