[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
John Winer <[email protected]> |

To |
[email protected] |

Subject |
st: compare groups using bootstrap |

Date |
Fri, 29 Jan 2010 23:13:50 -0800 (PST) |

hello statalisters, I am fairly new to stata and still trying to get to grips with it. I recently encountered a problem with bootstrap difference in means test. The code that I am using is based on several messages on the statalist. For example the one from brian poi of stata corp http://www.stata.com/statalist/archive/2004-04/msg00187.html. I have 10 numbers of such two group comparisions and this is my code. for i=1(1)10 { bootstrap r(t), reps(1000) seed(5432) saving(bs_1,replace):ttest var if gid==`i', by(group) unequal unpaired bootout } * this will output the results in a table *! version 1.0 a 25 jan 2010 capture program drop bootout program define bootout version 9 syntax matrix b = e(b) matrix se = e(se) local names : colnames(se) local df = e(N) - colsof(b) tempname t lb ub local i = 1 foreach var of local names { scalar `t' = (b[1, `i'] / se[1, `i']) scalar `lb' = b[1, `i'] - se[1, `i']*invttail(`df', 0.025) scalar `ub' = b[1, `i'] + se[1, `i']*invttail(`df', 0.025) di "`var'" _col(15) %9.0g b[1,`i'] /// _col(26) %9.0g se[1, `i'] /// _col(38) %6.2f `t' /// _col(46) %6.3f 2*ttail(`df', abs(`t')) /// _col(56) %9.0g `lb' /// _col(68) %9.0g `ub' local i = `i' + 1 } end Is this the right way to do this? Also the above bootout prog assumes that the distribution of the bootstrapped t is normal. in otherwords the CI that i construct is based on a normal disribution. How does one use the BCa or the percentile CI and work out a t statistic and p value for the difference in mean? thanks john * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**Re: st: Which command to test whether proportions of categories are the same in two sets of people?** - Next by Date:
**st: Re: file write and latex table** - Previous by thread:
**st: Replicate a SAS example with xtmixed, STATA 11** - Next by thread:
**st: Re: file write and latex table** - Index(es):

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