This file contains hidden or 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
#!/bin/bash | |
# Usage: mkproj [projectname] | |
# projectname defaults to name of current directory | |
template="Version: 1.0\nRestoreWorkspace: Default\nSaveWorkspace: Default\nAlwaysSaveHistory: Default\n\nEnableCodeIndexing: Yes\nUseSpacesForTab: Yes\nNumSpacesForTab: 4\nEncoding: UTF-8\n\nRnwWeave: knitr\nLaTeX: pdfLaTeX" | |
wd=$(basename `pwd`) | |
if [ -z $1 ]; then |
This file contains hidden or 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
data{ | |
# n_subj: number of subjects | |
int n_subj ; | |
# n_y: number of outcomes | |
int n_y ; | |
# y: matrix of outcomes | |
matrix[n_subj,n_y] y ; | |
# n_fac: number of latent factors | |
int n_fac ; | |
# y_fac: list of which factor is associated with each outcome |
This file contains hidden or 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
library("dplyr") | |
library("audio") | |
notes <- c(A = 0, B = 2, C = 3, D = 5, E = 7, F = 8, G = 10) | |
pitch <- "D D E D G F# D D E D A G D D D5 B G F# E C5 C5 B G A G" | |
duration <- c(rep(c(0.75, 0.25, 1, 1, 1, 2), 2), | |
0.75, 0.25, 1, 1, 1, 1, 1, 0.75, 0.25, 1, 1, 1, 2) | |
bday <- data_frame(pitch = strsplit(pitch, " ")[[1]], | |
duration = duration) |
This file contains hidden or 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
data { | |
int N; | |
int M; | |
real<lower=0> Y[N]; | |
} | |
parameters { | |
real<lower=0> mu; | |
real<lower=0> phi; | |
real<lower=1, upper=2> theta; |
This file contains hidden or 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
set.seed(1) | |
# Create fake data | |
x = runif(100, 0, 5) | |
y = .25 * x^3 - x^2 + rnorm(length(x)) | |
data = data.frame(x = x, y = y) | |
# Identify 500 points to include in the plots | |
x.sequence = seq(0, 5, length = 500) |
This file contains hidden or 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
getmatch <<- function(x,str2match,...) { | |
unlist(regmatches(x,regexpr(str2match,x,...))) } |
This file contains hidden or 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
######### These are my attempts to incorporate McCann's models into R to help me interpret these food web models ###################### | |
### Section 2.2.5 | |
# parameters and state variables for the R-M model | |
r <- 1.0 # per capita rate of increase in resource | |
K <- 2.0 | |
e <- 0.5 | |
Ro <- 0.5 | |
m <- 0.5 | |
a <- 1.6 |