Re: "bootstrap" statistics [message #30833 is a reply to message #30826] |
Tue, 21 May 2002 00:54   |
Ivan Valtchanov
Messages: 8 Registered: April 2002
|
Junior Member |
|
|
On 20 May 2002 20:41:44 +0100
wmc@bas.ac.uk wrote:
> Hello group. I want to do what I think of as "bootstrap" statistics, viz
> given a timeseries I take a random subsample (with, say, half the number
> of elements), compute some statistic (say, then mean); then take another
> random subsample; then again lots of times (say 1000 or 10000) and end
> up with a distribution of the statistic concerned.
>
> So: to do this I need a means to generate n/2 random (non-repeating)
> indices from 0...n-1. At the moment I do this by:
> once I have m indices I generate one more at
> random; see if its in the list of m; if not, good; if it is, generate another
> one. This is hideously inefficient and slow: there *must* be a better way.
>
Hello,
It is some sort of jacknife technique. I can propose you one solution:
ndata = float(n_elements(myarray)) ; myarray is the input array
for i=0, ngen-1 do begin
x = randomu(s,ndata)
flag = nint(x) ; nearest integer, so should have half times zeros and half times ones
ixx = where(flag EQ 0)
tmp = myarray ;
remove,ixx,tmp ; using Wayne Landsman astrlib REMOVE.PRO
mx[i] = mean(tmp)
endfor
Hope this helps.
Ivan
--
============================================================ ============
Ivan Valtchanov e-mail:ivaltchanov@cea.fr
DSM/DAPNIA/Service d'Astrophysique
CEA/Saclay tel: +33(0)1.69.08.34.92
Orme des Merisiers, bat.709 fax: +33(0)1.69.08.65.77
91191 Gif-sur-Yvette, France
============================================================ ============
|
|
|