Skip to content

Instantly share code, notes, and snippets.

@adambear91
adambear91 / Templeton_Presentation.ipynb
Created January 29, 2019 20:26
Code and data for Templeton presentation 1/30/19.
View Templeton_Presentation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adambear91
adambear91 / tobit_vs_OLS_simulations.R
Created January 8, 2018 17:34
Calculates p-values in censored data sets using OLS and Tobit regression
View tobit_vs_OLS_simulations.R
require(ggplot2)
require(GGally)
require(VGAM)
# Function to create a simulated data set and run models on it
oneRun <- function(number_of_obs,eff_IV1,eff_IV2,baseline,sd,lowerCutoff,upperCutoff,roundOn){
# partition data into 4 conditions, specified by IV1 and IV2
partition <- number_of_obs /4
df <- expand.grid(IV1 = c(T,F), IV2 = c(T,F))
df <- df[rep(row.names(df), partition), 1:2]
@adambear91
adambear91 / AA_BearKaganRand_master_file.m
Created March 27, 2017 21:57
Code for Bear, Kagan, & Rand (2017)
View AA_BearKaganRand_master_file.m
% % % % % % % % % % % % % % % % % % %
% CODE FOR BEAR, KAGAN & RAND (2017) PROCB
%
% This MATLAB script runs the low mutation limit (steady state) calculations
% shown in Figures S1-S12
%
% This script calls the following functions:
%
% calculate_payoff_YDYI(strategy1,strategy2,b,c,d,p,YD,YI)
% - returns the payoff of strategy1 against strategy2 given
@adambear91
adambear91 / AA_BearRand_master_file.m
Last active December 22, 2020 13:15
Code for Bear Rand (2016) PNAS
View AA_BearRand_master_file.m
% % % % % % % % % % % % % % % % % % %
% CODE FOR BEAR RAND (2016) PNAS
%
% This MATLAB script runs the low mutation limit (steady state) calculations
% shown in Figures 2a and S1-S3, as well as the agent-based simulations
% for higher mutation rates shown in Figure S3, and plots the results.
%
% This script calls the following functions:
%
% calculate_payoff(strategy1,strategy2,b,c,d,p)