Skip to content

Instantly share code, notes, and snippets.

@ProbablePattern
Created March 9, 2014 21:52
Show Gist options
  • Save ProbablePattern/9455292 to your computer and use it in GitHub Desktop.
Save ProbablePattern/9455292 to your computer and use it in GitHub Desktop.
require(boot)
# Simple example of bootstrapping mean from 100 random numbers
x <- rnorm(100)
y <- tsboot(x, mean, R=10, l=20, sim=”fixed”)
# histogram of R number of statistic (index = t of interest from tsboot output)
plot(y, index=1)
# matrix of the data index (column) occurring in bootstrap replicate (row)
y.array <- boot.array(y)
# Write to CSV
write.csv(y.array,”/yourdirectory/yourfile1.csv”)
write.csv(x,”/yourdirectory/yourfile2.csv”)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment