Skip to content

Instantly share code, notes, and snippets.

View aammd's full-sized avatar

Andrew MacDonald aammd

  • Université de Sherbrooke
  • Montreal, Canada
View GitHub Profile
m <- 0.086
o <- (1-m)/m
curve((sqrt(o) - sqrt(o^-1)) / sqrt(x^2 - x + 1), xlim = c(0,50))
abline(h = 1/3)
@aammd
aammd / example_data_manipulation.Rmd
Created May 18, 2020 15:33
tidyverse translation of Tim's demo on data manipulation
---
title: "Exploring observations"
author: "Andrew, based on Tim's lecture!"
date: "18/05/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
library(tidyverse)
#> Warning: package 'tibble' was built under R version 4.0.2
#> Warning: package 'tidyr' was built under R version 4.0.2
#> Warning: package 'dplyr' was built under R version 4.0.2
tibble(x = 0:42,
       y1 = pbinom(x, 42, 0.3),
       y2 = 1-pbeta(0.3, x+1, 42-x)) %>% 
  ggplot(aes(x = x, y = y1)) + 
 geom_point(col = "green", size = 3) + 
@aammd
aammd / prior_on_logit_scale.R
Last active March 10, 2021 15:34
Minimal shiny app to simulate priors on a logit scale
library(shiny)
library(bslib)
library(thematic)
library(ggplot2)
thematic::thematic_shiny(font = "auto")
# take a vector, make a histogram