I hereby claim:
- I am aammd on github.
- I am aammd (https://keybase.io/aammd) on keybase.
- I have a public key ASAjkSpXgWkiID1aVIJksW_plP1S60NKHq3lnNrdFeLD8wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
library(pageviews) | |
require(lubridate) | |
today <- pageview_timestamps() | |
earlysept <- pageview_timestamps(lubridate::ymd("2017-09-01")) | |
korsmit <- pageviews::article_pageviews("en.wikipedia", "Roy_Kortsmit", start = earlysept, end = today) | |
korsmit %>% | |
ggplot(aes(x = date, y = views)) + theme_minimal() + geom_line() + geom_point() + | |
labs(title = "Roy Kortsmit wikipedia pageviews", subtitle = "Before and after he made 4 saves in 5s.") |
#!/bin/bash | |
# Usage: mkproj [projectname] | |
# projectname defaults to name of current directory | |
template="Version: 1.0\nRestoreWorkspace: Default\nSaveWorkspace: Default\nAlwaysSaveHistory: Default\n\nEnableCodeIndexing: Yes\nUseSpacesForTab: Yes\nNumSpacesForTab: 4\nEncoding: UTF-8\n\nRnwWeave: knitr\nLaTeX: pdfLaTeX" | |
wd=$(basename `pwd`) | |
if [ -z $1 ]; then |
library(brms) | |
library(tidyverse) | |
# we're going to have 5 animals | |
nspp <- 5 | |
# in 100 sites | |
nsites <- 100 | |
#abilities are between -1 and 1, from a normal distribution: | |
thetas <- rnorm(nspp, 0, 1.2) |
simulate_one_cardoso <- function(.cardoso_island = cardoso_island){ | |
spp_names <- unique(.cardoso_island$morphospecies) | |
nspp <- length(spp_names) | |
bromeliad_names <- unique(.cardoso_island$Bromeliad) | |
nbrom <- length(bromeliad_names) | |
# simulate from the parameters: | |
b_intercept <- rnorm(1, 1, 0.2) |
library(tidyverse) | |
set.seed(4812) | |
islands <- data_frame(area = | |
# runif(35, min = 0, max = 29) | |
rlnorm(35, meanlog = log(5), sdlog = log(3)) | |
) | |
dragon_response <- function(b0, b1){ | |
force(b0) | |
force(b1) |
info <- function(x, a, b) { | |
a * (exp(a * (x - b))) / (exp(a * b) + exp(a * x)) ^ 2 | |
} |
using Plots | |
# a vector of r values | |
Rs=collect(0.1:0.001:3) | |
T = 5000 | |
N=zeros(length(Rs), T) | |
#Set t0 values to 1 | |
N[:,1] .= 1 |
pwr <- function(S, a, mu = 0.086, phi=240){ | |
D <- S * (S - 1) | |
2 * (D + 1) * (D/(phi + 1) + 1) * mu * ( 1 - mu) + ( a * mu + mu) * (1 - a * mu - mu) * (2.8)^2 / ((D + 1)*a*mu)^2 | |
} | |
pwr(6, 0.10) | |
curve(pwr(x, 0.4), xlim = c(3,30)) | |
curve(pwr(x, 0.2), xlim = c(3,30), log = "y") |
library(tidyverse)
cv <- 2.5
sigma = seq(0.2,5,by = 0.2)
list(mean = sigma / cv, sd = sigma) %>% transpose %>%
set_names(., nm = map_chr(., lift_dl(paste, sep="_"))) %>%
map(lift_dl(partial, .f = dnorm)) %>%
map_df(~ tibble(x = seq(-2,3.5,0.01),
y = .x(x)), .id = "mean_sd") %>%
ggplot(aes(x = x, ymax = y, ymin = 0, fill = mean_sd)) + geom_ribbon() +