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

From |
"Nuno" <liststata@gmail.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: Bootstrapped skewness-adjusted t-stat question |

Date |
Sat, 1 Mar 2008 19:24:45 -0000 |

Dear all, I'm trying to calculate the bootstrapped skewness-adjusted t-stat proposed by Lyon, Barber, and Tsai (1999), 'Improved Methods for Tests of Long-Run Abnormal Stock Returns', The Journal of Finance, Vol. 54, No. 1, pp. 165-201, in order to correct the skewness inherent to stocks returns. However, given that this a user defined function, I'm having some problems with the programming and I wondering if anyone could give me some ideas of to solve my problems. The procedure is the following: - Draw 1000 bootstrapped resamples from the original sample of size nb=n/4, ie, 1/4 of the total sample; X is the variable of interest; Xb is the variable of interest for the bootstrapped sample; - adjusted t-stat calculated as: sqrt(nb)*(Sb+1/3*Sb^2+1/(6nb)*lambda) Where, - Sb=(mean(Xb)-mean(X))/std.dev(Xb) - lambda=sum[(Xb-mean(Xb))^3]/(nb*std.dev(Xb)^3) I've written the following program *------ start program ------ cap tempvar drop all cap program drop _all cap local drop cap global drop sysuse auto,clear summarize mpg, meanonly global mu_ar=r(mean) capture program drop boottstat program define boottstat, rclass preserve summarize mpg local mu_arb=r(mean) local sd_arb=r(sd) local n_arb=r(N) tempvar diff gen `diff'=(mpg-`mu_arb')^3 summarize `diff' local sum_diff=r(sum) local lambda=`sum_diff'/(`n_arb'*`sd_arb'^3) local sb=(`mu_arb'-`mu_ar')/`sd_arb' return scalar boottstat = sqrt(`n_arb')*(`sb'+(1/3)*`sb'^2+(1/(6*`n_arb'))*`lambda') restore end bootstrap "boottstat" r(boottstat), reps(100) size(18) trace *------ end program ------ When I run this piece of code, I get the following programs: - it doesn't run correctly. When it reaches the "local sb=(`mu_arb'-`mu_ar')/`sd_arb'" line it gives me an error message "invalid name" preceded with a lot of numbers(2972972972973). These numbers are the decimal places of the results from `mu_arb'. I don't understand why this happens. Any ideas? Could it be from the global `mu_ar'? Ive noticed that the -summarize mpg- after -preserve- also returns the summary of what seems a tempvar (the name is "__000004") and it already returns the 2972972972973 numbers. - I create the new tempvar diff in order to calculate lambda. However, I'm not sure if Stata is creating this variable based on the subsample or all the sample. Can anyone clarify this? - In the bootstrap command I define size as 18 (1/4 of the auto sample). However, according to the information provided by Stata with the -summarize- command inside the program, all the statistics mu_arb, n_arb,and sd_arb seem to use all the sample. Shouldn't Stata restrict the sample since I define size as 18 and only pass the 18 observations to the program? Any help anyone can provide is really welcome! Best wishes, Nuno * * 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/

**Follow-Ups**:**Re: st: Bootstrapped skewness-adjusted t-stat question***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**st: Fwd: Frontier Cost Function** - Next by Date:
**st: marginal effects IV probit** - Previous by thread:
**st: Fwd: Frontier Cost Function** - Next by thread:
**Re: st: Bootstrapped skewness-adjusted t-stat question** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |