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/