- htttp://www.pearselab.com/
- @willpearse
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
data <- c(120, 130, 110, 105, 121) | |
n.iter <- 10000 | |
mu.prior <- function(x) dnorm(x, mean=0, sd=10) | |
sd.prior <- function(x) dnorm(x, mean=0, sd=10) | |
posterior <- function(x, mu, sigma) sum(c( | |
dnorm(x, mu, abs(sigma), log=TRUE), | |
mu.prior(x), sd.prior(x) | |
)) | |
proposal <- function(x) x + rnorm(1, 0, sd=.25) | |
mu <- 90 |
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
# Rough-and-ready body-mass/species-number estimation in mammals and birds | |
# Will Pearse - 2021-09-19 | |
########################## | |
# Load data ############## | |
########################## | |
library(caper) | |
library(ape) | |
library(Pareto) |
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
#' @export | |
.reed.2017a <- function(...) { | |
data <-read.csv("http://pasta.lternet.edu/package/data/eml/knb-lter-sbc/17/30/a7899f2e57ea29a240be2c00cce7a0d4", as.is=TRUE) | |
names(data) <- tolower(names(data)) | |
data$count[data$count < 0] <- 0 | |
data$taxon_species[data$taxon_species == -99999] <- NA | |
data$taxon_genus[data$taxon_genus == -99999] <- NA | |
data$species <- with(data, paste(taxon_genus, taxon_species, sep="_")) |
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
# Packages | |
library(geiger) | |
library(caper) | |
library(phytools) | |
# Simulate phylogeny and some traits | |
tree <- sim.bdtree(n=100) | |
traits <- sim.char(tree, .01, nsim=7)[,1,] | |
# Fuss around to make a discrete character |
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
#!/usr/bin/ruby | |
require 'optparse' | |
require 'csv' | |
options = {} | |
OptionParser.new do |opts| | |
#Defaults | |
options[:output] = nil | |
options[:input] = nil | |
options[:lat] = "lat" |
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
# PICS and PGLS - oh my! | |
# Will Pearse - 2018-04-03 | |
# Headers | |
library(ape) | |
library(caper) | |
library(geiger) | |
library(phytools) | |
library(mvMORPH) |
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
# Headers | |
library(pez) | |
data(laja) | |
############################# | |
# SETUP ##################### | |
############################# | |
# Make a comparative community object from a phylogeny and some | |
# site-species community data - some invertebrates found in some |
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 | |
library(caper) | |
find.clade <- function(tree, tips){ | |
clade.mat <- clade.matrix(tree)$clade.matrix | |
sums <- rowSums(clade.mat) | |
ancestors <- apply(clade.mat, 1, function(x) all(x[tips]==1)) | |
sums[!ancestors] <- length(tree$tip.label) | |
return(unname(which.min(sums))) | |
} | |
bind.replace <- function(backbone, donor, replacing.tip.label){ |
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
#Loading a package | |
library(pez) | |
#Building a tree | |
tree <- read.tree("Vascular_Plants_rooted.dated.tre") #file from http://datadryad.org/resource/doi:10.5061/dryad.63q27 | |
species <- c("Quercus_notreal","Pinus_notreal","Blasia_notreal","Riccia_notreal") | |
tree <- congeneric.merge(tree, species) | |
tree <- drop.tip(tree, setdiff(tree$tip.label, species)) | |
#Calculating PD |
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
#!/usr/bin/ruby | |
require 'optparse' | |
require 'json' | |
require 'open-uri' | |
require 'nokogiri' | |
############################ | |
# ARGUMENT PARSING ######### | |
############################ | |
options = {} |
NewerOlder