Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: RE: Bootstrapping confidence interval of mean difference


From   "Matt Spittal" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: Bootstrapping confidence interval of mean difference
Date   Mon, 18 Aug 2008 11:47:08 +1000

Hi Sue,

I think see what you are looking for.  If you imagine in the example below that the variable weight is the difference between two groups, then you can write your own bootstrap program. 

	sysuse auto, clear

	// step 1
	sum weight
	matrix mean = r(mean)

	// step 2
	capture program drop bootmean
	program define bootmean, rclass
		version 10.1
		preserve
			bsample
			sum weight
			return scalar mean = r(mean)
		restore
	end

	// step 3
	simulate mean = r(mean), reps(100) seed(12345): bootmean
	bstat, stat(mean) n(200)
	estat bootstrap, all
	

You can compare this to the ususal confidence interval by typing

	ci weight 

This sort of thing is covered very well on the website below

	http://www.ats.ucla.edu/stat/Stata/faq/ownboot.htm

Efron, B. and Tibshirani, R. J. (1993) An Introduction to the Bootstrap. Chapman & Hall/CRC Press is well worth reading also.

-- Matt
[email protected] 



-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Susan Maree
Cotton
Sent: Monday, 18 August 2008 11:27 AM
To: [email protected]
Subject: st: RE: RE: Bootstrapping confidence interval of mean
difference


Hi Matt,

Thanks for your response.  I had thought of the approach below but
envisaged some difficulties with the estimation.  The bootstap would be
based on sampling from one group and not two independent groups, and
each time a new sample is bootstrapped there may be different numbers in
the two groups? Given that standard error is based on n couldn't this be
a problem. 

KR

Sue

Dr Sue Cotton 
Senior Research Fellow 
ORYGEN Research Centre
Department of Psychiatry
University of Melbourne
Locked Bag 10 (35 Poplar Road) 
Parkville Victoria 
Australia 3052
Phone: +61 3 9342-2859
Fax:      +61 3 9342-2941
Mobile:  0407-340-115
[email protected] 
 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Matt Spittal
Sent: Monday, 18 August 2008 11:07 AM
To: [email protected]
Subject: st: RE: Bootstrapping confidence interval of mean difference

Hi Susan,

An equivalent method would be to use linear regression with dummy coding
for the treatment groups.  Ignoring the issue of bootstrapping, in Stata
this would be:

	sysuse auto, clear
	xi: regress weight i.foreign

where -xi- expands terms containing categorical variables into indicator
variables, and -i.foreign- is the indicator of treatment assignment.  If
you type

	ttest weight, by(foreign)

you can see the estimate of the mean difference is the same as the beta
for _Iforeign_1 from the regression.

To bootstrap the standard errors type

	xi: bootstrap, seed(12345) reps(100): regress weight i.foreign

which will give the confidence intervals you desire. Setting the seed
ensures that you can reproduce the results later. The -reps- command
sets the number of repetitions.

-- Matt
[email protected]




-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Susan Maree
Cotton
Sent: Monday, 18 August 2008 10:48 AM
To: [email protected]
Subject: st: Bootstrapping confidence interval of mean difference
Importance: High


 
Hi All,
I have data from a randomized clinical trial with intervention and
treatment as usual groups. The outcome data is cost-effectiveness data.
Reviewers of a manuscript pertaining to data from this trial have
requested that the bootstrapped confidence interval of the mean
difference between groups be reported.   
I am a new user to STATA and have been having difficulties determining
the correct commands to generate these confidence intervals.  I have
worked out how to bootstrapping for the confidence intervals of the
means for the two groups separately and to bootstrap the t-distribution
pertaining to difference between groups but cannot work out the
confidence interval for mean difference.  Please help!!
Thanks in advance.
KR
Sue
 
Dr Sue Cotton 
Senior Research Fellow 
ORYGEN Research Centre
Department of Psychiatry
University of Melbourne
Locked Bag 10 (35 Poplar Road) 
Parkville Victoria 
Australia 3052
Phone: +61 3 9342-2859
Fax:      +61 3 9342-2941
Mobile:  0407-340-115
[email protected] 

*
*   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/

*
*   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/

*
*   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/



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