|
Pedram,
I wrote the following program for my students to illustrate sampling
rows. It actually creates a random number data index based on the number
of rows in your dataset and the number of people (rows) that you want to
sample. We then use this data index as the parameter from which we sample
the original dataset.
Kyle
#### Program: SAMPLE ROWS
#### This is a program to sample rows of data #### rather
than just single data points from one variable
#### First, let's suppose a matrix like the
following mat<-rbind(c(1,2,3), c(4,5,6), c(7,8,9)) mat
#### Next we will determine the number of people to
sample #### from the above dataset n.people<-2
#### Here we will create a matrix called data.index that
#### will be the variable from which we will sample from the
#### original dataset. data.index will be a vector of
numbers #### the length of which is the number of people in
n.people #### which has random numbers corresponding to the rows of
#### the original dataset. data.index<-matrix(sample(nrow(mat),
size = n.people, replace = T)) data.index
output<-mat[data.index,] output
***************************************************** J. Kyle Roberts,
Ph.D. Assistant Professor of Educational Research University of North
Texas P.O.Box 311337 Denton, TX 76203-1337 voice -
940-369-7168 fax - 940-565-2185 kroberts@unt.edu***************************************************** >>>
Pedram Sendi <psendi@uhbs.ch> 11/18/02 10:23AM >>> Dear
All I have data on costs and effects of a medical intervention for 20
patients and would like to generate the joint distribution of mean
costs and effects via bootstrapping. The data are in a 2x20 matrix with each
row representing a patient with the respective cost and effect data. How do
I bootstrap each row (rather than the mean for costs and effects separately)
for estimating the joint distribution of mean costs and effects in S-Plus?
I am using S-Plus 2000 on Windows. Thanks a lot for your
help! Pedram Pedram Sendi, MD, DSc Institute for
Clinical Epidemiology & Division of Infectious Diseases Institut fur
klinische Epidemiologie & Abteilung fur Infektiologie Basel University
Hospital Kantonsspital Basel Hebelstrasse 10, 3rd Floor CH-4031
Basel Phone: +41 61 265 31 02 Fax: +41 61 265 31 09 E-Mail:
psendi@uhbs.ch -------------------------------------------------------------------- This
message was distributed by s-news@lists.biostat.wustl.edu.
To unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu
with the BODY of the message: unsubscribe
s-news
|