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
# Show selected output | |
First we redefine the output hook: | |
```{r setup} | |
# the default output hook | |
hook_output = knit_hooks$get('output') | |
knit_hooks$set(output = function(x, options) { | |
if (!is.null(n <- options$out.lines)) { | |
if(length(n)==1) n<-c(n,n) |
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
####################################################################################################################################### | |
# | |
# Compare Different Types of Meta-Analysis Method | |
# for calculating an effect size from LRR1 | |
# | |
# Jarrett Byrnes | |
# Last Updated Dec 9,2012 11am | |
# | |
# Changelog | |
####################################################################################################################################### |
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
r3 <- c(0L, 3000L, 1765L, 8645L, 6225L, 805L, 600L, 203L, 115L, 85L, | |
2700L, 1210L, 3790L, 2210L, 2135L, 610L, 5180L, 840L, 2200L, | |
410L, 1440L, 3080L, 1280L, 1165L, 4040L, 1110L, 6585L, 3015L, | |
2651L, 290L, 1990L, 0L, 810L, 5004L, 790L) | |
r1 <- c(1165L, 1129L, 2835L, 1000L, 5000L, 1120L, 1266L, 2100L, 1330L, | |
420L, 1070L, 128L, 1120L, 220L, 1075L, 1170L, 825L, 3000L, 1104L, | |
210L, 122L, 151L, 490L, 4600L, 2483L, 265L, 1565L, 1545L, 4110L, | |
10171L, 1000L, 1240L, 899L, 1320L, 848L, 605L, 970L, 545L, 1815L, | |
515L, 5085L, 450L, 755L, 1170L, 250L, 3243L, 1305L, 715L, 711L |
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
###### | |
# Here are some methods to create a variable | |
# lagged at t-1. You can see some obvious ways to | |
# generate arbitrary lags. | |
# | |
# See also http://ctszkin.com/2012/03/11/generating-a-laglead-variables/ | |
# for some more tricks. | |
# | |
# I wonder why there is no generic function in base for this? | |
# |
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
#################################### | |
### Demo of calculating LLs of | |
### group structures | |
### And plotting them using the network package | |
### | |
### Jarrett Byrnes | |
### Last updated: 4/11/2013 | |
#################################### | |
source("./getNetworkAIC.R") |
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
library(multifunc) | |
#A function to get mm coefs | |
mmCoef <- function(adf){ | |
options(warn=2) | |
mod <- try(nls(funcMaxed~Vm*Diversity/(K+Diversity), start=list(Vm=1, K=5), | |
data=adf)) | |
options(warn=0) |
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
source("./sciFundFunctions.r") | |
library(car) | |
projects$Round = "1" | |
projects2$Round = "2" | |
projects3$Round = "3" | |
commonCols <- intersect(names(projects2), names(projects3)) | |
#merge just the columns we need for the analysis | |
cols <- qw(total, Contributors, meanDonation, medianDonation, Goal, Round, Fully.funded., Contributors, Pageviews) |
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
library(ggplot2) | |
library(plyr) | |
### | |
#let's simulate a diversity experiment with monocultures and polycultures | |
### | |
set.seed(2202) | |
mono <- 8 | |
n <- 8 |
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
############### | |
# quantRegLines - a function to plot lines from | |
# a quantile regression at multiple levels of Tau | |
# | |
# Jarrett Byrnes | |
# | |
# Last Updated Dec 2, 2013 | |
# | |
# Changelog | |
############### |
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
#Michaelis-Menten function with the max function set to 1 | |
#takes h as an argument, the half-saturation | |
mm <- function(x, h) x/(x+h) | |
#simple power function | |
pow <- function(x, p) x^p | |
#x<-1:100 | |
#plot(x, mm(x), type="l") | |
#plot(x, pow(x), type="l") |