Latest commit to the master branch

updated slides

commit 50fe434303
ben-domingue authored
Txt 100644 42 lines (37 sloc) 0.836 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#1. stuff you might change
n.proc <- 10
n.boot <- 500
x <- rnorm(1000)
y <- 3*x+rnorm(1000)

#2. set up the index
index <- list()
for (i in 1:n.boot) {
  index[[i]] <- data.frame(x=x,y=y)
}

#3. get function ready
fun <- function(dat) {
  new.index <-
    sample(1:nrow(dat),nrow(dat),replace=TRUE)
  dat <- dat[new.index,]
  x <- dat$x
  y <- dat$y
  #why not lm(y~x)
  mod <- lsfit(x,y)
  coef(mod)
}

#4. snow stuff
require(snow)
out <- list()
cl <- makeCluster(n.proc,type="MPI",verbose=FALSE)
#seed <- round(runif(6)*1000)
#clusterSetupRNG(cl,type="RNGstream",seed=seed)
out <- clusterApply(cl,index,fun)
stopCluster(cl)
#####probably want to save something.
mpi.quit()

#####################################################
#assess results
summary(lm(y~x))
matrix(unlist(out),ncol=2,byrow=TRUE)->z
apply(z,2,sd)
mpi.quit()

Markdown Cheat Sheet

Format Text

Headers

# This is an <h1> tag
## This is an <h2> tag
###### This is an <h6> tag

Text styles

*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__

*You **can** combine them*

Lists

Unordered

* Item 1
* Item 2
  * Item 2a
  * Item 2b

Ordered

1. Item 1
2. Item 2
3. Item 3
   * Item 3a
   * Item 3b

Miscellaneous

Images

![GitHub Logo](/images/logo.png)
Format: ![Alt Text](url)

Links

http://github.com - automatic!
[GitHub](http://github.com)

Blockquotes

As Kanye West said:

> We're living the future so
> the present is our past.

Code Examples in Markdown

Syntax highlighting with GFM

```javascript
function fancyAlert(arg) {
  if(arg) {
    $.facebox({div:'#foo'})
  }
}
```

Or, indent your code 4 spaces

Here is a Python code example
without syntax highlighting:

    def foo:
      if not bar:
        return true

Inline code for comments

I think you should use an
`<addr>` element here instead.

Something went wrong with that request. Please try again. Dismiss