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

RE: st: ado coding help needed

From   "Rajesh Tharyan" <>
To   <>
Subject   RE: st: ado coding help needed
Date   Thu, 6 Mar 2008 15:52:19 -0000


Thank you Scott very much for help. It is very much appreciated. 

This gives me enough ammunition to go ahead and improve it further. This is
a very commonly used procedure in empirical corporate finance research. May
be it is too common !! And often used without considering other alternatives
as was pointed out before by Maarten . But, I know at least four people
personally who are using the procedure for their thesis. Therefore,
something like this, once properly finished would be very useful.

Kindly let me know if you have any ideas on how to improve this further...

Sorry for not including the full reference. 

LBT (1999) is 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.

Johnson(1978) is Johnson, Norman J. 1978. Modified t Tests and Confidence
Intervals for Asymmetrical Populations. Journal of the American Statistical
Association 73, no. 363:536-544.

Thanks again for your help

-----Original Message-----
[] On Behalf Of Scott Merryman
Sent: 06 March 2008 14:03
Subject: Re: st: ado coding help needed

On Thu, Mar 6, 2008 at 4:24 AM, Rajesh Tharyan <>
> I have two programs One to calculate the skewness adjusted t stats
> (rtskew.ado) and the other to do the bootstrap (skewt.ado)
> Could someone please tell me If I can do this with one program and how?

What is Johnson(1978) and LBT(1999)?

You might want to take a look at -syntax-

Here is one way:

capture program drop skewt
program define skewt, rclass
syntax varlist, [bs saving(string) size(integer 1) reps(integer 100) replace
foreach var of varlist `varlist' {
capture confirm numeric variable `var'
	if _rc==0 {
		quietly sum `var',detail
		di ""
		di in gr _col(5)  "`var' stats from the sample"
		di ""
		di in gr _col(5) "N coefficient  = `=sqrt(r(N))'"
		di in gr _col(5) "S-coefficient  = `=r(mean)/r(sd)'"
		di in gr _col(5) "G-coefficient  = `r(skewness)'"
		di in gr _col(5) "Sample mean    = `r(mean)'"
		di ""
		local ratio = (`=sqrt(r(N))') * ((`=r(mean)/r(sd)') + ((1/3)
(`r(skewness)') * ((`=r(mean)/r(sd)')^2)) ///
			+((1/(6*((`=sqrt(r(N))')^2)))* (`r(skewness)')))
		return scalar ratio_`var'=`ratio'
	else {
		di as input "`var'" as text " is not a numeric variable
adjusted t-statistic cannot be calculated."

if "`bs'" == "bs" {
	if "`saving'" != "" {
		local saving `saving'_`var'
	bootstrap r(ratio_`var'), saving("`saving'", `replace') reps(`reps')
size(`=int(_N/`size')') `options': rtskew `var'

sysuse auto,clear
skewt weight
skewt mpg gear price, bs reps(10) size(2) nowarn nohead saving(bs) replace

*   For searches and help try:

*   For searches and help try:

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