s-news
[Top] [All Lists]

Re: Bootstrap; How can I get the replicates themselves?

To: Weigl Klemens <weiglk@stud.uni-graz.at>
Subject: Re: Bootstrap; How can I get the replicates themselves?
From: Tim Hesterberg <timh@insightful.com>
Date: Mon, 10 Sep 2007 13:46:33 -0700
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <1189455604.46e5a6f50285b@webmail.stud.uni-graz.at> (message from Weigl Klemens on Mon, 10 Sep 2007 22:20:05 +0200)
References: <1189455604.46e5a6f50285b@webmail.stud.uni-graz.at>
If DATA is a data frame with columns x and y, then do:
        save.boot <- bootstrap(DATA, cor(x,y))
        save.boot$replicates  # Here are the 1000 values.

In general, to find this out, look at the help file for the function.
The section "Return Value" should describe the structure of the object.


For (2), if you want to save those 1000 values into a data frame, do

        myDataFrame <- data.frame( myName = save.boot$replicates )

Tim Hesterberg

========================================================
| Tim Hesterberg       Senior Research Scientist       |
| timh@insightful.com  Insightful Corp.                |
| (206)802-2319        1700 Westlake Ave. N, Suite 500 |
| (206)283-8691 (fax)  Seattle, WA 98109-3044, U.S.A.  |
|                      www.insightful.com/Hesterberg   |
========================================================
Download S+Resample from www.insightful.com/downloads/libraries

Bootstrap Methods and Permutation Tests
                Oct 10-11 San Francisco
http://www.insightful.com/services/training.asp


>Dear S-News Members!
>
>
>--> I´m bootstrapping a correlation-coefficient as statistic of interest for
>two columns of a dataset. This works fine, but I´d also want to know the
>following: 
>
>(1) How can I get all the, for example 1000, replicates of the
>correlation-coefficient (for further calculations)?
>
>
>(2) Furthermore, exists there a simple function/code/syntax to get all the
>replicates in a "new" column of a new created dataset (whichone S-Plus creates
>automatically)? I think it should be easy with the right Syntax/code, but I
>still haven´t found the right one yet.
>
>
>This works not that bad: 
>>x[ indices[ 1, ] ]
>
>but exists there another, better solution?
>
>
>Additional information:
>I´m working with "Resample-library" on Windows XP and S-Plus Version 7.0.
>
>Apologies for my question, but I´m a beginner.
>I´d be very happy, if anyone could help me.
>
>Thanks und best wishes,
>Weigl Klemens

<Prev in Thread] Current Thread [Next in Thread>