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

st: Bootstrapped skewness-adjusted t-stat question

From   "Nuno" <>
To   <>
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)

- Sb=(mean(Xb)-mean(X))/
- lambda=sum[(Xb-mean(Xb))^3]/(nb*^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
		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 =

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

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


*   For searches and help try:

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