Skip to content

Instantly share code, notes, and snippets.

Jarrett Byrnes jebyrnes

Block or report user

Report or block jebyrnes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jebyrnes
jebyrnes / sims3.r
Created May 19, 2011
Simulations of beta regression as compared to other techniques designed for working on response variables on a unit (0,1) scale.
View sims3.r
######
#script to generate simulations comparing the power and type I error rate
#of a variety of different methods of analyzing response variables on a unit (0-1) scale
#
# Inspired by "The Arcsine is Asinine" in a 2011 issue of Ecology
#
# byrnes@nceas.ucsb.edu
# last updated 5/19/11
#
# Changelog: Added visualization code
@jebyrnes
jebyrnes / projects.csv
Created Nov 13, 2011
Code to scrape RocketHub's xml feeds for the #SciFund projects, add it to a log file, then plot it. Run the data scrape without appending the first time to generate a log file.
View projects.csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
"ID","Title","Name","Project.Link","Goal"
1,"Why is this Dolphin's Fin on Backwards!?","Matthew S. Leslie","http://www.rockethub.com/projects/3754-why-is-this-dolphin-s-fin-on-backwards","5000"
2,"Tracking the migration of the Atlantic Puffin","Robin Freeman","http://www.rockethub.com/projects/3818-tracking-the-migration-of-the-atlantic-puffin","5000"
3,"Cancer? Yeast has the answers","Marisa Alonso-N??ez","http://www.rockethub.com/projects/3753-cancer-yeast-has-the-answers","2500"
4,"Athlete's Foot in Worms?","Rebecca Rashid Achterman","http://www.rockethub.com/projects/3703-athlete-s-foot-in-worms","1000"
5,"Support Zombie Research!","Kelly Weinersmith","http://www.rockethub.com/projects/3737-support-zombie-research","3500"
6,"Doctor Zen and the Amazon Crayfish","Zen Faulkes","http://www.rockethub.com/projects/3695-doctor-zen-and-the-amazon-crayfish","1000"
7,"C-Cilia in Motion!!","Aditya Rao","http://www.rockethub.com/projects/3792-c-cilia-in-motion","5000"
8,"Force of Duck: Measuring explosive erection","
@jebyrnes
jebyrnes / allPredPrey.r
Created Dec 7, 2011
Simulations of all predators and prey applying the p(eaten) formula for a probabilistic approach to food webs
View allPredPrey.r
###############FUNCTIONS
#If you find the 0 predators remaining formulation more intuitive
pEaten2<-function(Sp.max, E, prey.vec) {
1-mean(dhyper(0,prey.vec, Sp.max-prey.vec, Sp.max-E))
}
#vectorize it
pEaten2<-Vectorize(pEaten2, vectorize.args="E")
#generate all permutations of prey being eaten
@jebyrnes
jebyrnes / iworkfortheinternet.R
Created Dec 14, 2011 — forked from sckott/iworkfortheinternet.R
Code for searching Twitter using the twitteR #rstats package.
View iworkfortheinternet.R
require(plyr); require(stringr); require(ggplot2); require(lubridate); require(twitteR)
##need to figure out why there are two datout objects and not just 1...
twitterPlot<-function(myString, n=1500, since=NULL, until=NULL){
since2<-as.character(strptime(since, '%Y-%m-%d')+2*24*60*60)
until2<-as.character(strptime(until, '%Y-%m-%d')+2*24*60*60)
datout_1 <- searchTwitter(myString, n = n, since=since, until=until)
datout_2 <- searchTwitter(myString, n = n, since=since2, until=until2)
@jebyrnes
jebyrnes / goal_success_scifund.R
Created Feb 28, 2012
Analysis code for looking at the relationship between project goal and % success from #SciFund. Note, I did it with my own private data set that has a lot of merged fields in it, but you can run this analysis or something like it with Zen's data at http:
View goal_success_scifund.R
source("./sciFundFunctions.r")
library(gridExtra)
#################################################
#######HISTOGRAMS
#################################################
#total raised histogram distribution
raised<-qplot(total, data=projects) +
theme_bw(base_size=16) +
xlab("\nTotal Raised") +
@jebyrnes
jebyrnes / pageviews.R
Created Mar 6, 2012
Analysis code for looking at the relationship between page views and dollars raised for #SciFund
View pageviews.R
source("./sciFundFunctions.r")
library(gridExtra)
############
#Begin with a plot of both with and without the outlier
############
viewsAll<-qplot(Pageviews, total, data=projects)+theme_bw(base_size=24) + ylab("Total Dollars Raised\n") +
xlab("\nPage Views") +
@jebyrnes
jebyrnes / Maestre_reanalysis.R
Created Apr 23, 2012
Code to Re-Analyze the results of Maestre et al 2012 Spurred on by Bob O'Hara, Jeremy Fox, and Ted Hart's ongoing discussions
View Maestre_reanalysis.R
########################################################################################################
# Re-Analysis of Maestre et al 2012
# examining relationship between biodiversity and ecosystem multifunctionality
# Paper and data included as a supplement can be found at http://dx.doi.org/10.1126/science.1215442
########################################################################################################
######################
####### First, let's look at standardized regression coefficients
####### Both for the best fit model, but also for the model averaged coefficients
######################
@jebyrnes
jebyrnes / martine.R
Created Sep 27, 2012
Martine's Code
View martine.R
enthus <- read.csv("enthusiasm.csv", header = TRUE)
# Plot the data
plot ( Chapters ~ Enthusiasm, data = enthus +
type = "p", pch = 20 +
main ="Holy Homework!" +
xlab = "Enthusiam units (week number)", xlim = c (0,3) + ylab = "Number of chapters", ylim = c (0,11))
# Fit regression line
abline (lm (Chapters ~ Enthusiasm, data = enthus))
# get equation for limera regression, R-squared and p-value
@jebyrnes
jebyrnes / hubway_dataviz.R
Created Nov 5, 2012
Visualize the Hubway Data
View hubway_dataviz.R
##################################################################################################################
######
###### Code to visualize the Hubway Data Set
###### for the Hubway Data Challenge
###### http://hubwaydatachallenge.org/
######
###### Jarrett Byrnes, http://jarrettbyrnes.info
######
###### Last Updated Nov 5, 2012
##################################################################################################################
@jebyrnes
jebyrnes / ma_senate_2012.R
Created Nov 6, 2012
MA Senate Projection
View ma_senate_2012.R
#load the excellent methods to query polls
#linked to at http://alandgraf.blogspot.com/2012/11/quick-post-about-getting-and-plotting.html
source("https://raw.github.com/dlinzer/pollstR/master/pollsterAPI.R")
#get the MA Senate Race
datMass <- pollstR(chart="2012-massachusetts-senate-brown-vs-warren",pages="all")
#reshape the data for plotting
library(reshape2)
dm <- melt.data.frame(datMass, id.vars=c("start.date", "N"), measure.vars=c("Warren", "Brown"))
You can’t perform that action at this time.