[R] Re : Bootstrap sampling for repeated measures
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Tue May 15 17:56:28 CEST 2007
justin bem wrote:
> Hi,
>
> If it was me I would have done this
> - First reshape the data frame to get some thing like
>
> header measure1 measure3 measure3 ....
> 1280001 2.47 1.48 2.23 ...
>
> Since you have same number of measure for all subject. The you define you statistic with the data frame in this form. and you can use the boot function in boot or Hmisc bootstrap function.
>
>
> Justin BEM
I don't think that's the best way to go. As in the Design package (see
the predab.resample, validate, calibrate functions) and the Hmisc
rm.boot function you can easily sample from subject IDs and put together
the needed records.
Frank Harrell
> Elève Ingénieur Statisticien Economiste
> BP 294 Yaoundé.
> Tél (00237)9597295.
>
> ----- Message d'origine ----
> De : Niccolò Bassani <biostatistica at gmail.com>
> À : r-help at stat.math.ethz.ch
> Envoyé le : Mardi, 15 Mai 2007, 11h15mn 51s
> Objet : [R] Bootstrap sampling for repeated measures
>
> Dear R users,
> I'm having some problems trying to create a routine for a bootstrap
> resampling issue. Suppose I've got a dataset like this:
>
> Header inr ........ weeks .....
> 1280001 2.47 ........ 0 .......
> 1280001 1.48 ........ 1 .......
> 1280001 2.23 ......... 2 ......
> ........................
> ........................
> 1280369 2.5 ....... 56 ........
>
> i.e. a dataset with n subjects identified by the column "header", with a set
> of repeated mesaures. The amount of repeated measures for each subject is
> 57, with a few of them being more or lesse frequent. That is, generalizing,
> that I haven't got the same number of observations for each patient.
> I've created a function allowing me to to reorder, subsetting and calculate
> some statistics over this dataset, but now I need to bootstrap it all. I was
> looking for a routine in R that could resample longitudinal data, in order
> to resample "on the ID of the subjects". This means that while resampling
> (suppose m samples of n length) I wish to consider (better with replacement)
> either none or all of the observations related to a subject.
> So, if my bootstrap 1st sample takes the patient with header 1280001, I want
> the routine to consider all of the observations related with a subject with
> such a header.
> Thus, I shall obtain a bootstrap sample of my original dataset to wich apply
> the function cited before (whose only argument is the dataset).
> Can anybody help me? I'm trying to understand how the rm.boot function from
> Hmisc package resamples this way, but it's not that easy, so if anyone could
> help me I'd be very grateful.
> Thanks in advance
> Niccolò
>
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>
>
>
>
>
>
> ___________________________________________________________________________
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list