I hereby claim:
- I am oliviergimenez on github.
- I am oliviergimenez (https://keybase.io/oliviergimenez) on keybase.
- I have a public key ASB-o-5D4dk5Z6DU4-8VoO-wp5QG9xYe5qDlKeahp3FveAo
To claim this, I am signing this object:
| ### Title: Back to basics: High quality plots using base R graphics | |
| ### An interactive tutorial for the Davis R Users Group meeting on April 24, 2015 | |
| ### | |
| ### Date created: 20150418 | |
| ### Last updated: 20150423 | |
| ### | |
| ### Author: Michael Koontz | |
| ### Email: [email protected] | |
| ### Twitter: @michaeljkoontz | |
| ### |
| # Implements Lasso for logistic regression, both classical/bayesian ways | |
| ## 1. SIMULATION | |
| # for reproducibility | |
| set.seed(666) | |
| # sample size | |
| n <- 100 |
| # we seek to test whether two parameters, say theta1 and theta2, are diff from each other, using a z-test | |
| # we assume we have an estimate of the thetaj's (mle1 and mle2) and associated standard errors (se1 and se2) | |
| # we write a function that calculate the z-statistic and return the p-value (both-sided test) | |
| # function | |
| ztest <- function(mle1, mle2, se1, se2){ | |
| stat <- (mle1 - mle2)/sqrt(se1^2+se2^2) | |
| pvalue <- ifelse(stat > 0, 2 * pnorm(stat, lower.tail = FALSE), 2 * pnorm(stat, lower.tail = TRUE)) | |
| return(data.frame("z-score" = stat, "p-value" = pvalue)) | |
| } |
| # Cook, J. D., D. M. Williams, W. F. Porter, and S. A. Christensen. 2022. | |
| # Improved predictions and forecasts of chronic wasting disease occurrence | |
| # using multiple mechanism dynamic occupancy modelling. | |
| # Journal of Wildlife Management. | |
| # Simulation and multi-mechanism dynamic occupancy model code | |
| #load necessary libraries | |
| library(raster) | |
| library(mvtnorm) |
| # from Cole Monnahan https://github.com/colemonnahan/fcwhales | |
| convert_to_df <- function(fit, name = NULL){ | |
| fit <- as.mcmc(fit) | |
| post <- data.frame(do.call(rbind, fit)) | |
| new <- gsub('[.]$', '', names(post)) | |
| new <- gsub('[.]','_', new) | |
| names(post) <- new | |
| if(!is.null(name)) post$model <- name | |
| return(post) | |
| } |
| ##--- Finite-mixture capture-recapture models | |
| ##--- O. Gimenez & D. Turek, December 2019 & October 2020 | |
| ##--- Check out our paper | |
| ##--- Turek, D., C. Wehrhahn, Gimenez O. (2021). Bayesian Non-Parametric Detection Heterogeneity in Ecological Models. | |
| ##--- Environmental and Ecological Statistics 28: 355-381. | |
| ##--- PDF available here: https://arxiv.org/abs/2007.10163 | |
| ##--- More on heterogeneity in capture-recapture models in | |
| ##--- https://onlinelibrary.wiley.com/doi/abs/10.1111/oik.04532 |
| # we get same AIC when fitting Rota model with no interaction | |
| # vs fitting MacKenzie model to species separatately | |
| library(unmarked) | |
| library(mipfp) | |
| ?occuMulti | |
| # simulate 2 species data | |
| # https://github.com/oliviergimenez/2speciesoccupancy |
I hereby claim:
To claim this, I am signing this object:
| # some R code to mimic animated gifs created by Etienne Jacob | |
| # @etiennejcb | |
| # https://bleuje.github.io/tutorials/ | |
| ## load required packages | |
| library(tidyverse) | |
| theme_set(theme_void(base_size = 14)) | |
| library(gganimate) | |
| ##-- first tutorial https://bleuje.github.io/tutorial1/ |
| # https://zhuhao.org/post/tips-on-designing-a-hex-sticker-for-rstats-packages/ | |
| # https://github.com/GuangchuangYu/hexSticker/ | |
| library(tidyverse) | |
| library(hexSticker) | |
| library(png) | |
| library(grid) | |
| theme_set(theme_minimal()) | |
| df <- 4 |