Skip to content

Instantly share code, notes, and snippets.

@torfjelde
torfjelde / generated_quantities_chains.jl
Last active March 28, 2024 20:03
Converting output from `generated_quantities(model, chain)` into a `MCMCChains.Chains` object
julia> using Turing
julia> include("utils.jl")
julia> @model function demo(xs)
s ~ InverseGamma(2, 3)
m ~ Normal(0, s)
for i in eachindex(xs)
xs[i] ~ Normal(m, s)
end
@ivanperez-keera
ivanperez-keera / Associate org-mode files with emacs.md
Last active August 7, 2021 10:06
Associate Org-mode files with emacs (on Linux)

On linux, files tend to be identified by type, not extension.

org-mode files are text files, but only a few editors support org-mode (emacs, vim, etc.)

This file can be used to associate org-mode files to a specific editor (like emacs), while using other editors for plain text files.

  • Save as /usr/share/mime/packages/org.xml;
  • Run
@amoeba
amoeba / anscombe-ggplot.r
Last active October 6, 2019 08:57
Anscombe's Quartet with ggplot2
library(ggplot2)
theme_set(theme_bw(base_size=18))
anscombe_m <- data.frame()
for(i in 1:4)
anscombe_m <- rbind(anscombe_m, data.frame(set=i, x=anscombe[,i], y=anscombe[,i+4]))
ggplot(anscombe_m, aes(x, y)) + geom_point(size=5, color="red", fill="orange", shape=21) + geom_smooth(method="lm", fill=NA, fullrange=TRUE) + facet_wrap(~set, ncol=2)