Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Functions for simulating Conway's Game of Life | |
## Modified from http://www.petrkeil.com/?p=236 | |
neighbour_count <- function(X) | |
{ | |
side <- nrow(X) | |
# make the shifted copies of the original array | |
allW = cbind( rep(0,side) , X[,-side] ) | |
allNW = rbind(rep(0,side),cbind(rep(0,side-1),X[-side,-side])) | |
allN = rbind(rep(0,side),X[-side,]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################### | |
## | |
## Functions for calculating AUC and plotting ROC | |
## Corey Chivers, 2013 | |
## corey.chivers@mail.mcgill.ca | |
## | |
################################################### | |
## Descrete integration for AUC calc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Simulate Grime Dice ## | |
red<-c(4,4,4,4,4,9) | |
blue<-c(2,2,2,7,7,7) | |
olive<-c(0,5,5,5,5,5) | |
yellow<-c(3,3,3,3,8,8) | |
magenta<-c(1,1,6,6,6,6) | |
## Play n match-ups between d1 and d2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################### | |
## Intro to Simulation - R/Stats Intro Series | |
## Designed by: Corey Chivers, 2013 | |
## Department of Biology, McGill University | |
######################################################### | |
##@ 0.1 @## | |
rm(list=ls()) # Housekeeping | |
#setwd('<my working directory>') # set working dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################## Plot training skies ################### | |
## | |
## corey.chivers@mail.mcgill.ca | |
## | |
########################################################## | |
## calculate a vector given | |
## x,y,e1,e2 | |
gal_line<-function(g,scale=100) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Corey Chivers, 2012 ## | |
sim_bayes<-function(p=0.5,N=100,y_lim=20,a_a=2,a_b=10,b_a=8,b_b=3) | |
{ | |
## Simulate outcomes in advance | |
outcomes<-sample(1:0,N,prob=c(p,1-p),replace=TRUE) | |
success<-cumsum(outcomes) | |
for(frame in 1:N) | |
{ | |
png(paste("plots/",1000+frame,".png",sep="")) |
NewerOlder