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: Bootstrap sampling for evaluating hypothesis tests

From   Margaret MacDougall <>
Subject   Re: st: Bootstrap sampling for evaluating hypothesis tests
Date   Mon, 10 Jun 2013 16:44:51 +0100


I refer to the recommendation from Maarten below, which was sent in response to a query I raised about testing the robustness of a new hypothesis test to Type I errors.

I have a very large sample to work from and I am expecting the null hypothesis (involving a comparison of two correlation coefficients) to be refuted for these data. My question is as follows: are there recommended approaches, other than crude trial and error, to adapting experimental data which naturally refute a null hypothesis so that the null hypothesis is satisfied? In this particular case, there are three variables to consider and therefore the data for each would need to be modified so that one correlation coefficient was equal to the other. I have a gut feeling that there are possibly bog-standard versus statistically sound approaches to fixing the data to meet the null hypothesis and would welcome some advice.

Many thanks

Best wishes


Dr Margaret MacDougall
Medical Statistician and Researcher in Education
Centre for Population Health Sciences
University of Edinburgh Medical School
Teviot Place
Edinburgh EH8 9AG

Tel:  +44 (0) 131 650 3211
Fax:  +44 (0) 131 650 6909

On 13/03/2013 15:45, Maarten Buis wrote:
On Wed, Mar 13, 2013 at 4:04 PM, Margaret MacDougall wrote:
I would value receiving recommendations on literature explaining the
application of bootstrap sampling to assess robustness to Type I errors of a
proposed new hypothesis test. Better still, if the recommended references
contain corresponding computer syntax!

Rich Williams and I are currently working on such a project. In
general I would not say that a test is "robust" against Type I errors
but that the Type I error rate corresponds to your prespecified level
of significance. Type I errors will occur, but the chance of it
occuring should be the same as the level of significance you have
chosen. This means that if we change the data such that the null
hypothesis is true and bootstrap from that changed dataset the
p-values should follow a uniform distribution. This changing the data
is inevitable when assessing the Type I error rate: in order to assess
the probability of rejecting a true null hypothesis you first need to
make sure that the null hypothesis is true.

Here are two examples of how to do this in Stata:

*------------------ begin example ------------------
clear all
sysuse auto
recode rep78 1/2=3
logit foreign price
predict double pr
gen byte ysim = .
keep foreign price rep78 pr ysim
keep if !missing(foreign,price,rep78)
program define sim
	replace ysim = runiform()<  pr
	logit ysim  price ib3.rep78
	test 4.rep78 = 5.rep78 = 0
simulate chi2=r(chi2) p=r(p), reps(1000) : sim
simpplot p
qchi chi2, df(2) name(q)
*------------------- end example -------------------
(For more on examples I sent to the Statalist see: )

*------------------ begin example ------------------
clear all
sysuse auto
gen lnprice = ln(price)
reg turn mpg i.rep78 foreign
predict double mu1

reg turn mpg i.rep78 foreign weight lnprice
predict double mu2
gen double ysim = turn - mu2 + mu1

keep ysim mpg rep78 foreign weight lnprice
keep if !missing(ysim, lnprice, mpg, rep78, foreign, weight)
tempfile temp
save `temp'

  program define qenv_sim_F
     use `1', clear
     reg ysim mpg i.rep78 foreign weight lnprice
     test weight lnprice

simulate F=r(F) p=r(p), reps(1000): qenv_sim_F `temp'

simpplot p
*------------------- end example -------------------
(For more on examples I sent to the Statalist see: )

Hope this helps,

Maarten L. Buis
Reichpietschufer 50
10785 Berlin
*   For searches and help try:

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

*   For searches and help try:

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