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
#ifndef DIRICHLET_RNG_WRAPPER_HPP | |
#define DIRICHLET_RNG_WRAPPER_HPP | |
#include <stan/math.hpp> | |
#include <boost/random/mersenne_twister.hpp> | |
#include <chrono> | |
#include <Eigen/Dense> | |
#include <iostream> | |
// Declare an integer to keep track of the iteration count |
This file has been truncated, but you can view the full file.
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
<!DOCTYPE html> | |
<html lang="en"><head> | |
<script>/*! | |
* clipboard.js v2.0.11 | |
* https://clipboardjs.com/ | |
* | |
* Licensed MIT © Zeno Rocha | |
*/ | |
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.contain |
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
if(!("pak" %in% as.data.frame(installed.packages())$Package)){install.packages("pak")} | |
require(pak) | |
pkg_load <- function(...) { | |
if(!("pak" %in% as.data.frame(installed.packages())$Package)){install.packages("pak")} | |
pack <- sapply(match.call(), as.character)[-1] | |
pack[!(pack %in% as.data.frame(installed.packages())$Package)] -> to_install | |
if(length(to_install) > 0) pak(to_install) else "" | |
lapply(X = pack, FUN = function(x){tryCatch(require(x, character.only = T), error = function(e){NULL})}) -> 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
library(qs) | |
`%q>%` <- function(lhs, rhs){as.character(substitute(rhs)) -> name | |
qcache(substitute(lhs), name = name) -> value | |
assign(x = name, value = value, envir = .GlobalEnv)} |
We can't make this file beautiful and searchable because it's too large.
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
county_code,county_name,county_name_long,municipality_code,municipality_name,municipality_name_long,regso_code,regso_name,deso,valdeltagande | |
01,Stockholm,Stockholms län,0114,Upplands Väsby,Upplands Väsby kommun,0114R001,Bollstanäs,0114C1010,0.88 | |
01,Stockholm,Stockholms län,0114,Upplands Väsby,Upplands Väsby kommun,0114R001,Bollstanäs,0114C1030,0.88 | |
01,Stockholm,Stockholms län,0114,Upplands Väsby,Upplands Väsby kommun,0114R001,Bollstanäs,0114C1050,0.91 | |
01,Stockholm,Stockholms län,0114,Upplands Väsby,Upplands Väsby kommun,0114R002,Hammarby-Vaxmyra,0114C1180,0.84 | |
01,Stockholm,Stockholms län,0114,Upplands Väsby,Upplands Väsby kommun,0114R002,Hammarby-Vaxmyra,0114C1220,0.72 | |
01,Stockholm,Stockholms län,0114,Upplands Väsby,Upplands Väsby kommun,0114R003,Odenslunda norra-Frestaby-Ekeby,0114C1100,0.83 | |
01,Stockholm,Stockholms län,0114,Upplands Väsby,Upplands Väsby kommun,0114R003,Odenslunda norra-Frestaby-Ekeby,0114C1140,0.9 | |
01,Stockholm,Stockholms län,0114,Upplands Väsby,Upplands Väsby kommun,0114R004,Odenslunda södra |
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
to_clipboard <- function(x, row.names = F){ | |
write.table(x, "clipboard", row.names=row.names, sep='\t', na = "") | |
} |
This file has been truncated, but you can view the full file.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="generator" content="pandoc" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" /> |
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
library(tidyverse) | |
library(magrittr) | |
library(brms) | |
#library(betareg) # for example data | |
#### Code declaring ordered beta family for brms #### | |
# code from Robert Kubinec | |
# custom family | |
ord_beta_reg <- custom_family("ord_beta_reg", |
We can't make this file beautiful and searchable because it's too large.
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 source: Statistics Sweden | |
# No data on county and municipality level if count < 3 | |
# No data on country level if count < 2 | |
"sex","county_code","county","municipality","municipality_code","name","count" | |
"male",NA,NA,NA,NA,"Aadam",2 | |
"male",NA,NA,NA,NA,"Aadhiran",2 | |
"female",NA,NA,NA,NA,"Aadya",3 | |
"male",NA,NA,NA,NA,"Aahil",2 | |
"female",NA,NA,NA,NA,"Aaliya",2 | |
"female","12","Skåne län","Malmö","1280","Aaliyah",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
model.check.ocat <- function(model) { | |
# Some R 4.1 syntax here! | |
simulatedResponse = model %>% | |
predict(type="response") %>% | |
apply(1, \(x) sample(1:length(x), prob = x, size=1000, replace = TRUE)) %>% | |
t() | |
createDHARMa( | |
simulatedResponse = simulatedResponse, | |
observedResponse = model$y, | |
fittedPredictedResponse = model %>% predict(), # the linear predictor |
NewerOlder