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
###### | |
#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 | |
# | |
# [email protected] | |
# last updated 5/19/11 | |
# | |
# Changelog: Added visualization code |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
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
"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"," |
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 | |
#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 |
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
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) |
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(gridExtra) | |
################################################# | |
#######HISTOGRAMS | |
################################################# | |
#total raised histogram distribution | |
raised<-qplot(total, data=projects) + | |
theme_bw(base_size=16) + | |
xlab("\nTotal Raised") + |
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(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") + |
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
######################################################################################################## | |
# 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 | |
###################### |
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
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 |
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
################################################################################################################## | |
###### | |
###### 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 | |
################################################################################################################## |
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
#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")) |
OlderNewer