Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: Bootstrapping: Comparing the difference between means

From   "Fleming, Fiona M" <>
To   "" <>
Subject   st: Bootstrapping: Comparing the difference between means
Date   Wed, 3 Apr 2013 16:22:56 +0000


I am hoping someone can help! I have been trying to work out, all day, how I can perform a bootstrap on the mean difference of two samples. I have scoured the Statalist, FAQ etc to get ideas and have recently been  trying to replicate the programming and commands illustrated in Example 2 on  with my own data set i.e.:

// step 1
ttest dcp  if (del==1) + (del==2), by(del)
return list
matrix mu = (r(mu_1), r(mu_2))
matrix list mu
// step 2
capture program drop mydiffa
program define mydiffa, rclass
ttest dcp if (del==1) + (del==2), by(del)
estat mu
return scalar diffa_1 = r(mu_1)
return scalar diffa_2 = r(mu_2)

// step 3
simulate diffa_1=r(mu_1) diffa_2 = (r(mu_2), reps(100) seed(12345): mydiffa
bstat, stat (mu) n(200)
estat bootstrap, all

after running this 'simulate' I get the following error and cannot proceed- 
'' found where ':' expected

Please could you offer any advice as to what I am doing wrong? 

In addition, what I have written above will only give me the bootstrap SE and CI for each of the means and not the difference of the means, if you have any further advice on how I might run that I would be extremely grateful.

Many thanks

Fiona Fleming

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index