Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Bootstrapped Paired-Samples (Dependent) T-Test

From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Bootstrapped Paired-Samples (Dependent) T-Test
Date   Thu, 27 Jan 2011 17:43:23 +0000

I was thinking of something like

sysuse bplong, clear
reshape wide bp, i(patient) j(when)
bootstrap r(t) , reps(10000)  : ttest bp1 == bp2

The regression approach has various advantages, not least that it can
be generalised to e.g. -glm- if different assumptions or links seem


On Thu, Jan 27, 2011 at 5:28 PM, Hartman, Rob <[email protected]> wrote:
> My original objective was to employ bootstrapping, and as far as I know, you can't employ bootstrapping in a paired t-test context.  If there is a way, and I'm just confused on how to apply the bootstrapping syntax: (1) apologies, (2) I welcome a tip on the syntax.
> Beyond that, my plan was to use the third regression approach below (w/ more reps).
> set seed 123
> sysuse bplong, clear
> regress bp when
> regress bp when, cluster(patient)
> regress bp when, cluster(patient) vce(bootstrap (_b[when]),rep(10) seed(123)) nodots
On Behalf Of Nick Cox

> With this structure you'll have to -reshape wide- to use -ttest- for
> the paired case. That's what I'm assuming. I don't know how else you
> were thinking of doing the test.
> Nick
> On Thu, Jan 27, 2011 at 4:58 PM, Hartman, Rob <[email protected]> wrote:
>> 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
> Nick Cox
>> I don't see a difference or a difficulty. Bootstrapping resamples from
>> a set of observations (cases, records, rows in dataset) and paired
>> values for two variables remain paired.
>> On Thu, Jan 27, 2011 at 3:42 PM, Hartman, Rob <[email protected]> wrote:
>>> I want to apply bootstrapping to a paired samples t-test.  I'm not aware of a straightforward application of this in Stata.  My impulse is to treat the t-test as a special case of regression, and thus use regress with a dummy predictor and bootstrapping of clustered standard errors, where the clustering is on the particular matched pair.
>>> Is there a reason why this does not make sense in principle or would not work in practice? Any other workarounds? Am I making it harder than it has to be?

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index