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
# Multi-species dynamic occupancy model with R and JAGS | |
# Written by Max Joseph | |
# maxwell.b.joseph@colorado.edu | |
# see http://www.colorado.edu/eeb/gradstudents/joseph/community_occ.html | |
# for details | |
# convenience functions | |
logit <- function(x) { | |
log(x/(1 - 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
vioplot2 <- function (x, ..., range = 1.5, h = NULL, ylim = NULL, names = NULL, | |
horizontal = FALSE, col = "magenta", border = "black", lty = 1, | |
lwd = 1, rectCol = "black", colMed = "white", pchMed = 19, | |
at, add = FALSE, wex = 1, drawRect = TRUE, side="both") | |
{ | |
datas <- list(x, ...) | |
n <- length(datas) | |
if (missing(at)) | |
at <- 1:n | |
upper <- vector(mode = "numeric", length = n) |
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
## Simple bivariate Poisson model in stan | |
## following parameterization in Karlis and Ntzoufras 2003 | |
## Simulate data | |
n <- 50 | |
# indpendent Poisson components | |
theta <- c(2, 3, 1) | |
X_i <- array(dim=c(n, 3)) | |
for (i in 1:3){ |
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
#=============================================================================== | |
# Date: May 22, 2016 | |
# Author: Lindy Nelson | |
# Purpose: This script downloads monthly MODIS burn data from | |
# | |
# | |
# FTP Server: fuoco.geog.umd.edu | |
# | |
# |
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: "Coloring lidar point clouds with RGB imagery in R" | |
author: "Max Joseph" | |
date: "June 30, 2016" | |
output: | |
html_document: | |
keep_md: true | |
--- | |
```{r setup, echo = FALSE} |
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
# Script to get MCD14ML MODIS data | |
library(RCurl) | |
library(dplyr) | |
# fetch_MCD14ML() downloads all of the zipped data files for the | |
# MODIS MCD14ML data product | |
# | |
# args: | |
# dir: the name of a directory to store the zip files (string) | |
# overwrite: should existing data be overrwitten? (logical) |
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: "Your title here" | |
subtitle: a clever subtitle | |
author: "Your name" | |
date: "`r format(Sys.time(), '%d %B, %Y')`" | |
output: | |
beamer_presentation: | |
latex_engine: xelatex | |
fonttheme: "structurebold" | |
header-includes: |
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
# Importing data from USDA into large data file --------------------------- | |
library(stringr) | |
library(dplyr) | |
path_to_data <- "~/Desktop/ams_cattle_data/" | |
data_files <- list.files(path = path_to_data, pattern = "cattle", | |
full.names = TRUE) | |
# Define helper functions ------------------------------------------------- |
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 { | |
int<lower=1> n; | |
vector[n] x; | |
vector[n] y; | |
} | |
parameters { | |
real alpha; | |
vector[2] beta; | |
real<lower=0> sigma; |
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
# 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))) |
OlderNewer