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(RColorBrewer) | |
# RColorBrewer provides the palettes developped by Cynthia Brewer, you can check them | |
# out at http://colorbrewer2.org/ . | |
# make some mock data with interaction | |
x1 <- factor(rep(c('a','b','c'),each=33)) | |
x2 <- rnorm(99,10,2) |
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(ggplot2) | |
require(plyr) | |
# make toy data | |
set.seed(1) | |
dataf <- data.frame( | |
x = rnorm(100), | |
y = c(rnorm(50,-1), rnorm(50,1)), | |
cat = rep(c("A","B"), each=50) | |
) |
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(sicalis) | |
# plot the desired spectra, leaving room horizontally to add labels | |
plot(sicalis, select=2:4, xlim=c(300,800)) | |
# find the y position to add the labels right where they finish (wavelength=700) | |
# using nrow to select the last row (for the last wavelength value) | |
# subset the last wavelength value (column 1) |
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(ape) | |
require(geiger) | |
# use Geospiza data for example | |
data(geospiza) | |
phylo <- drop.tip(geospiza$geospiza.tree, 'olivacea') | |
bardata <- setNames(geospiza$geospiza.data$beakD, rownames(geospiza$geospiza.data)) |
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
# PARAMETRIC BOOTSTRAP NULL HYPOTHESIS TESTING OF FIXED-EFFECT IN A MIXED MODEL | |
# Same rationale can be used to test random effects | |
# adapted from Faraway 2006 | |
require(lme4) | |
# build the models to be tested | |
# note that to test fixed effects, one should use ML and not REML estimation | |
fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy, REML=F) |
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
# (very convoluted) function to plot tetrahedral colorspace | |
require(pavo) | |
require(scatterplot3d) | |
require(RColorBrewer) | |
# get the data | |
data(sicalis) | |
tcsdat <- tcs(vismodel(sicalis)) |
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(rstan) | |
require(geiger) | |
require(MCMCglmm) | |
# load data | |
data(geospiza) | |
# get the inverse of the phylogenetic variance-covariance matrix | |
tr <- drop.tip(geospiza$geospiza.tree, 'olivacea') | |
invA <- solve(vcv.phylo(tr)) |
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(rstan) | |
require(geiger) | |
require(MCMCglmm) | |
# load data | |
data(geospiza) | |
dat <- geospiza$geospiza.data | |
# create fake sample of trees | |
tr <- drop.tip(geospiza$geospiza.tree, 'olivacea') |
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 required packages | |
require(phytools) | |
require(geiger) | |
require(MCMCglmm) | |
data(bird.families) | |
# CASE 1: very high lambda |
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(ape) | |
require(geiger) | |
# use Geospiza data for example | |
data(geospiza) | |
phylo <- drop.tip(geospiza$geospiza.tree, 'olivacea') | |
bardata <- setNames(geospiza$geospiza.data[,'beakD'], rownames(geospiza$geospiza.data)) |
OlderNewer