start new:
tmux
start new with session name:
tmux new -s myname
--- | |
title: "tikz in Quarto!" | |
format: html | |
--- | |
```{r include=FALSE} | |
# Necessary for using dvisvgm on macOS | |
# See https://www.andrewheiss.com/blog/2021/08/27/tikz-knitr-html-svg-fun/ | |
Sys.setenv(LIBGS = "/usr/local/share/ghostscript/9.53.3/lib/libgs.dylib.9.53") |
#' symlog transformation | |
#' | |
#' `symlog_trans()` transforms data using `log(x)` for `abs(x) > thr`, where | |
#' `thr` is a tuneable threshold, but leaves the data linear for `abs(x) < thr`. | |
#' (credit for base code to https://stackoverflow.com/users/1320535/julius-vainora) | |
#' | |
#' | |
#' @param base base of logarithm | |
#' @param thr numeric threshold for transitioning from log to linear | |
#' @param scale numeric scaling factor for data |
# "impute" missing binary predictor | |
# really just marginalizes over missingness | |
# imputed values produced in generated quantities | |
N <- 1000 # number of cases | |
N_miss <- 100 # number missing values | |
x_baserate <- 0.25 # prob x==1 in total sample | |
a <- 0 # intercept in y ~ N( a+b*x , 1 ) | |
b <- 1 # slope in y ~ N( a+b*x , 1 ) |
darken <- function(color, factor=1.4){ | |
col <- col2rgb(color) | |
col <- col/factor | |
col <- rgb(t(col), maxColorValue=255) | |
col | |
} | |
lighten <- function(color, factor=1.4){ | |
col <- col2rgb(color) |