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")) |
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
library(nlme) | |
library(ggplot2) | |
library(lubridate) | |
library(dplyr) | |
#download data from https://www.google.com/trends/explore#q=%22i%20cant%20even%22&cmpt=q&tz=Etc%2FGMT%2B5 | |
i_cant_even <- read.csv("./i_cant_even.csv", skip=4) | |
#reformat weeks | |
i_cant_even$Week <- as.character(i_cant_even$Week) |
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
#################################### | |
### Demo of calculating LLs of | |
### group structures | |
### And plotting them using the network package | |
### | |
### Jarrett Byrnes | |
### Last updated: 4/11/2013 | |
#################################### | |
source("./getNetworkAIC.R") |