Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get control over the sample size? #165

Closed
LABclimate opened this issue Mar 9, 2017 · 2 comments
Closed

How to get control over the sample size? #165

LABclimate opened this issue Mar 9, 2017 · 2 comments

Comments

@LABclimate
Copy link

LABclimate commented Mar 9, 2017

Hello,

I would like to use bootstrap to calculate statistical significance of mean values of composites.
The composites have length l and are taken from a time-series of length L > l. Now I would like to compute null-composites by randomly selecting the same number of dates (i.e.: l elements) from the whole time-series as had been in the original composite.

Playing around I ended up with:
from arch.bootstrap import MovingBlockBootstrap
x = numpy.arange(1000) (original dataset)
MovingBlockBootstrap(3,x).conf_int(numpy.mean, reps=10000, size=.95)

However, MovingBlockBootstraps leaves me with composites of length l = L = 1000. Is there a way to change this?

I wondered, whether a function like
import random
def func(x): return np.mean(random.sample(x,l))
could do the job. But testing this with l=200, I got quite high fluctuations for the confidence intervals...

I would be very happy about any hint!
Thank you very much!
L

PS: I'm not sure, whether this github page is the right place to ask that kind of questions. If not I am happily willing to migrate the question to any other forum.

@bashtage
Copy link
Owner

bashtage commented Mar 9, 2017

The bootstrap sample is the same size as the original one. If you want. Smaller sample, you could do something like

k=20
def somestat(x):
    return stat(x[:k])

This is inefficient but simple.

@bashtage
Copy link
Owner

Let me know if this works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants