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

Re:st: RE: Bootstrap table cells

Subject   Re:st: RE: Bootstrap table cells
Date   Fri, 25 Feb 2005 10:35:44 -0000

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).





Date: Thu, 24 Feb 2005 17:59:59 -0000

From: "Nick Cox" <>

Subject: st: RE: Bootstrap table cells


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)".




DISCLAIMER: The information in this message is confidential and may be legally privileged. It is intended solely for the addressee. Access to this message by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. Thank you.

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