Representations:
- Hierarchical models
- Hidden Markov models
- Graphical models
- Non-parametric Bayes (distributions over functions)
Inference Approaches:
import sqlalchemy as sa | |
class EnumIntType(sa.types.TypeDecorator): | |
impl = sa.types.SmallInteger | |
values = None | |
def __init__(self, values=None): | |
sa.types.TypeDecorator.__init__(self) | |
self.values = values |
##################### | |
## R Benchmark 2.5 ## | |
##################### | |
# http://r.research.att.com/benchmarks/R-benchmark-25.R | |
# R Benchmark 2.5 (06/2008) [Simon Urbanek] | |
# version 2.5: scaled to get roughly 1s per test, R 2.7.0 @ 2.6GHz Mac Pro | |
# R Benchmark 2.4 (06/2008) [Simon Urbanek] | |
# version 2.4 adapted to more recent Matrix package | |
# R Benchmark 2.3 (21 April 2004) | |
# Warning: changes are not carefully checked yet! |
# Check URLs in a document | |
## This code will extract URLs from a text document using regex, | |
## then execute an HTTP HEAD request on each and report whether | |
## the request failed, whether a redirect occurred, etc. It might | |
## be useful for cleaning up linkrot. | |
if (!require("httr")) { | |
install.packages("httr", repos = "http://cran.rstudio.com/") | |
} |
group.mean <- function(x, group) { | |
out <- tapply(x, group, mean, na.rm = TRUE) | |
out[group] | |
} | |
data(state.fips, package = "maps") | |
state.fips <- unique(state.fips[,c("fips","abb")]) | |
state.fips$abb <- as.character(state.fips$abb) | |
state.fips <- rbind(state.fips, c(2, "AK")) | |
state.fips <- rbind(state.fips, c(15, "HI")) |
# metadata | |
data_source <- "https://docs.google.com/spreadsheets/d/1xa0iLqYKz8x9Yc_rfhtmSOJQ2EGgeUVjvV4A8LsIaxY/htmlview?sle=true#gid=0" | |
data_collectors <- "Jeremy Pressman (@djpressman, U of Connecticut) and\nErica Chenoweth (@EricaChenoweth, U of Denver)" | |
code_gist <- "https://gist.github.com/benmarwick/a1ac9c7235ebef542824512162ff2f44" | |
# ------------------------------------------------------------------------ | |
# read in data from google sheets to get a data frame |
#!/bin/bash | |
# | |
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html) | |
# modified by mike@mikepearce.net | |
# modified by aconway@[redacted] - handle diffs that introduce new files | |
# modified by t.broyer@ltgt.net - fixes diffs that introduce new files | |
# modified by m@rkj.me - fix sed syntax issue in OS X | |
# modified by rage-shadowman - cleaned up finding of SVN info and handling of path parameters | |
# modified by tianyapiaozi - cleaned up some diff context lines | |
# |
# code to understand product terms and probit models | |
# clear workspace | |
rm(list = ls()) | |
# load packages | |
library(tidyverse) | |
library(plotly) | |
# parameters |
# Simulation script for factor analysis ala Leung & Drton (2016) ---------- | |
library(rstan) | |
library(bayesplot) | |
m <- 5 # dimension of observed data (e.g., # traits) | |
k <- 2 # number of latent factors | |
n <- 100 # number of sample units (e.g., # species) | |
# residual variance matrix (is diagonal) | |
Omega <- diag(.3 + abs(rnorm(m, sd = .3))) |