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
## analysis code for Fiona Lee's class project | |
## Psych 241, Stanford Winter 2013 | |
library(ggplot2) | |
library(reshape2) | |
library(psych) | |
library(bootstrap) | |
library(lme4) | |
## for bootstrapping 95% confidence intervals | |
theta <- function(x,xdata,na.rm=T) {mean(xdata[x],na.rm=na.rm)} |
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
# mixture distribution power sims | |
rm(list=ls()) | |
# from http://stats.stackexchange.com/questions/27088/shapiro-francia-test-error | |
sf.testBIG=function (x) | |
{ | |
DNAME <- deparse(substitute(x)) | |
x <- sort(x[complete.cases(x)]) | |
n <- length(x) |
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
## this little script shows off the use of the pubmed API through bioconductor | |
## requires installing Biopython (using pip) | |
## also requires installing the DTD files for each of the Entrez API calls, | |
## but the instructions for this are given when you run the script | |
## useful list of Entrez databases that can be queried through API | |
# pmc_pubmed PubMed citations for these articles | |
# pmc_refs_pubmed PubMed article citing PMC article | |
# pmc_pmc_cites PMC articles that given PMC article cites | |
# pmc_pmc_citedby PMC article citing given PMC article |
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
--- | |
title: "RMarkdown for writing scientific papers: A minimal working example" | |
author: "Mike Frank" | |
date: "`r Sys.Date()`" | |
output: | |
html_document: | |
toc: true | |
number_sections: true | |
bibliography: mwe.bib | |
--- |
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
--- | |
title: 'Class 6a: Blake et al. (2015) exercise' | |
author: "Mike Frank" | |
date: "February 9, 2016" | |
output: | |
html_document: | |
toc: true | |
--- | |
# Intro |
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(purr) | |
library(tidyverse) | |
library(stringr) | |
# constants | |
locations <- 1:3 | |
timestep <- 1 | |
t_end <- 6 | |
t <- seq(0, t_end, timestep) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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(tidyverse) | |
library(purrr) | |
n1 = 12 | |
n2 = 30 | |
nsims = 10 | |
get_chi2 <- function(x) { | |
p1 <- rbinom(1, size = n1, prob = x$p1) | |
p2 <- rbinom(1, size = n2, prob = x$p2) |
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(tidyverse) | |
d <- read_csv("~/Desktop/med_table_shavit.csv") %>% | |
arrange(age_grp, kinship, donation, soc_dist) | |
# first plot | |
ggplot(d, | |
aes(x = soc_dist, y = med_amnt, col = age_grp)) + | |
geom_point() + | |
facet_grid(kinship ~ donation) + | |
geom_smooth(method="lm", formula = y ~ poly(x, 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
# very quick re-implementation of a loose version of Experiment 1 from | |
# Twomey & Westermann 2017 | |
# Mike Frank (mcfrank@stanford.edu) | |
library(autoencoder) | |
library(tidyverse) | |
# need this to evaluate pairwise distance in training sets | |
euclidean_pairwise <- function (x) { |
OlderNewer