Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Bootstrap table cells

From   "Nick Cox" <>
To   <>
Subject   RE: st: RE: Bootstrap table cells
Date   Fri, 25 Feb 2005 12:34:26 -0000

This gives much informative detail, but my 
comment remains the same. I think you 
need to decide what single statistic 
you want to focus on. I can't see that 
other software would change the issue. 


Thanks for the reply below Nick - reason behind request below.

I'm actually going to be presenting the results of a treatment flow survey from (say) 1000 real patient records over a two year period. At stage 0 (diagnosis) they could split (say) into 4 different groups. Some may stay on this initial regimen others may switch treatment (ie stage 1 reached) and so on for other further stages. Hence results can be shown in a decision tree layout. This is not a clinical trial just an audit of "normal" records.

I'm supposed to provide confidence intervals for the percent (of the total 1000 records) estimates at each sub branch. The way the records were collected over-represents patients who consult more often. I'm correcting for this bias by weighting the records by the inverse of their consultation frequency.

Bootstrapping to me seems a good (best?) solution. By creating a stage 1 variable which includes a subcategory "still at stage 0", I can use a weighted contingency table of stage0 versus stage1 which will show in one go all stage0 and stage1 combinations. It is actually only the percents (total) I'm interested in modelling. 

I envisaged writing code that for each bootstrap sample took the weighted contingency table figures (using matcell() sub command of tabulate) then converted them into percents and it would be this matrix of percents that I would bootstrap.

If anyone can suggest any tips how to do this in Stata I'd be most grateful. 

I'd also be interested in hearing if anyone knows if it possible to bootstrap matrices in R or Limdep (although I'd much utilise Stata if possible). 

Nick Cox

I don't think you can bootstrap with whole matrices. 
Or at least you can't -bootstrap- with whole matrices. 

That is a Stata problem, even if it may be 
complaining about something different. 

But I guess there is a conceptual problem in any 
case, unless you can point to a literature in which this makes sense as a species of bootstrapping problem. 


> I want to bootstrap the frequencies in contingency table.
> Please see simple
> program below. 
> sysuse auto, clear
> program tableboot, rclass
> tabulate `1' `2', matcell(answ)
> return matrix cellans answ
> end
> bootstrap "tableboot rep78 foreign" r(cellans)
> When run the bootstrap fails with error message " type
> mismatch error in
> statistic: r(cellans)".

*   For searches and help try:

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