Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Bootstrapped Paired-Samples (Dependent) T-Test
From
"Airey, David C" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Bootstrapped Paired-Samples (Dependent) T-Test
Date
Thu, 27 Jan 2011 11:36:12 -0600
.
It is worth noting a couple different ways to doing the paired t-test then.
clear
set more off
webuse fuel
// note p = 0.046 in all tests below, and near this in bootstrap versions
ttest mpg1==mpg2 // paired t-test
gen diff = mpg2-mpg1
ttest diff == 0 // one sample t-test on differences
bootstrap, reps(1000): regress diff // bootstrap of regression equivalent of one sample t-test
gen pair = _n // needed for reshaping to long
reshape long mpg, i(pair) j(time) // reshape to long
anova mpg time pair // anova equivalent of paired t-test
regress // show regression equivalent
regress mpg i.time i.pair // do regression equivalent
bootstrap, reps(1000): regress mpg time, vce(cluster pair) // bootstrap using cluster variable
> Right, I think we are on the same page, but just to clarify: The issue here is that since the predictor variable is binary status in the matched pair (e.g., are you the pre or the post score for case 39), the data would be in long format with the two members of each matched pair falling in separate rows with an id variable indicating their shared membership in a common pair. The data found via sysuse bplong are illustrative. So, I believe this would need to be long format w/ resampling of clusters, but perhaps I'm missing something.
>
> Pair Score PrePost
> 1 .8 0
> 1 .61 1
> 2 .4 1
> 2 .3 0
> ...
> 54 .9 1
> 54 .4 0
>
>
> Thanks,
> Rob
*
* 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/