This file contains hidden or 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
Thanks to wikipedia for the data :) |
This file contains hidden or 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
#273649 #647184 #B1B2C8 #A7755D #5D2E1C #38201C | |
#0F2B5F #5991C7 #8EC1E7 #B9DBF1 #D5A370 #7B4F37 | |
#5A7362 #6B867C #A1A897 #9A8D6B #8E6341 #432B21 | |
#1F150D #2B190C #513B2C #9B4D44 #893D37 #3E1B17 | |
#9C8A45 #CABE85 #678B88 #9CADAF #CCCCCC #EFEFEF | |
#1C3333 #226060 #639CA4 #D2AD7C #BE7245 #46211C | |
#0D1723 #112040 #204D88 #96ABC6 #D1DDE2 #EFEFEF | |
#000000 #350E16 #5E1521 #A72C29 #C44221 #EC702E | |
#A56B47 #C79982 #0D8EDA #23ADED #6BC6F5 #EFEFEF | |
#2A2432 #4F3855 #846D86 #EFEFCF #D5B77D #A89E5E |
This file contains hidden or 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
# get EXIF and make a map | |
library(leaflet) | |
library(lubridate) | |
library(plyr) | |
# all my photos are in a directory pre with subdirectories | |
pre <- "~/Dropbox/Photos/" | |
paths_to_photos <- c("some_sub_directory" | |
) |
This file contains hidden or 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("best_model.Rdata") | |
library(dsm) | |
library(raster) | |
# lazily get the plot data for the rug plot | |
plotdat <- plot(M) | |
# load the raster and mudge it into the format I want | |
dists <- stack("NA_Shore_Dist_10km_mean_10km.img") | |
dists <- as.data.frame(dists) |
This file contains hidden or 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 of ribbon seal data using a frequentist | |
### approach to a GAM | |
### David L Miller [email protected] | |
### License: GNU GPL v3 | |
# load data from | |
# https://github.com/pconn/SpatPred/blob/master/SpatPred/data/Ribbon_data.rda | |
load("Ribbon_data.rda") |
This file contains hidden or 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
# plot of size versus distance and sea state versus distance | |
# w. linear model and LOESS smoother overlay | |
# base graphics | |
par(mfrow=c(1,2)) | |
plot(distdata[c("size","distance")], xlab="Group size", ylab="Distance (m)",pch=19,col=rgb(0,0,0,0.4), cex=0.6) | |
# increase span from default 0.75 for slightly smoother curve | |
lo <- loess(distance ~ size, distdata, span=0.8) | |
lmm <- lm(distance ~ size, distdata) | |
preddat <- data.frame(size=seq(0,8,1)) |
This file contains hidden or 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
# example from ?mgcv::concurvity | |
library(mgcv) | |
## simulate data with concurvity... | |
set.seed(8);n<- 200 | |
f2 <- function(x) 0.2 * x^11 * (10 * (1 - x))^6 + 10 * | |
(10 * x)^3 * (1 - x)^10 | |
t <- sort(runif(n)) ## first covariate | |
## make covariate x a smooth function of t + noise... | |
x <- f2(t) + rnorm(n)*3 |
This file contains hidden or 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
# David L Miller 2015, MIT license | |
library(numDeriv) | |
library(animation) | |
# function taken from the "Gu & Wahba 4 term additive example" from mgcv::gamSim | |
f2 <- function(x) 0.2*x^11*(10*(1-x))^6+10*(10*x)^3*(1-x)^10 | |
xvals <- seq(0,1,len=100) |
This file contains hidden or 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
# Markov Random Fields with temporal interactions | |
# David L Miller 2015 | |
# Released under MIT license, YMMV | |
# example from ?mgcv::smooth.construct.mrf.smooth.spec | |
library(mgcv) | |
## Load Columbus Ohio crime data (see ?columbus for details and credits) | |
data(columb) ## data frame |
This file contains hidden or 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
# makes plots (somewhat) like those in ver Hoef and Boveng (2007) | |
# Jay M. Ver Hoef and Peter L. Boveng 2007. QUASI-POISSON VS. NEGATIVE BINOMIAL REGRESSION: HOW SHOULD WE MODEL OVERDISPERSED COUNT DATA? Ecology 88:2766–2772. http://dx.doi.org/10.1890/07-0043.1 | |
# http://www.utstat.utoronto.ca/reid/sta2201s/QUASI-POISSON.pdf | |
# calling with something like: | |
# par(mfrow=c(1,2)) | |
# # define the breaks |