Statalist


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

RE: st: ado coding help needed


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

Hi,

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
Rajesh

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

On Thu, Mar 6, 2008 at 4:24 AM, Rajesh Tharyan <[email protected]>
wrote:
<snip>
> 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?
>
<snip>

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
skewness
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'
	}
}
end


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

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

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