Skip to content

Instantly share code, notes, and snippets.

View certifiedwaif's full-sized avatar

Mark Greenaway certifiedwaif

  • University of Sydney
  • Sydney, Australia
View GitHub Profile
travis_fold:start:worker_info
Worker information
hostname: 6dc47c14-8e9d-4f9f-81c7-9b5fdf8db233@1.production-5-worker-org-a-1-gce
version: v3.6.0 https://github.com/travis-ci/worker/tree/170b2a0bb43234479fd1911ba9e4dbcc36dadfad
instance: travis-job-1af23089-3d0d-47c3-ac95-49d98f31b7d4 travis-ci-amethyst-trusty-1512508224-986baf0 (via amqp)
startup: 27.327058835s
travis_fold:end:worker_info
travis_fold:start:system_info
Build system information
Build language: r
parameters_tbl <- parameters_tbl %>%
mutate(sampler_mGamma=map(sampler_result, "mGamma"),
sampler_vip=map(sampler_mGamma, ~apply(.x, 2, mean)),
blma_vip=map(blma_result, "vinclusion_prob"),
error=map2_dbl(sampler_vip, blma_vip, ~sum((.x - .y)^2)))
@certifiedwaif
certifiedwaif / make_my_matrix_symmetric.py
Created August 12, 2018 11:21
What, you expect me to do this by hand?!?
matrix_str = """\\sigma^2_{\\text{intercept}} & & & & &
\\rho_{\\text{intercept} x} & \\sigma^2_x & \\ldots
\\rho_{\\text{intercept} x^2} & \\rho_{x x^2} & \\sigma^2_{x^2} & \\ldots
\\rho_{\\text{intercept} x^3} & \\rho_{x x^3} & \\rho_{x^2 x^3} & \\sigma^2_{x^3} & \\ldots
0 & \\rho_{x (x - \\kappa_1)^3_+} & \\rho_{x^2 (x-\\kappa_1)_+^3} & \\rho_{x^3 (x - \\kappa_1)_+^3} & \\sigma^2_{(x - \\kappa_1)_+^3} & \\ldots
0 & 0 & \\rho_{x^2 (x-\\kappa_2)_+^3} & \\rho_{x^3 (x-\\kappa_2)_+^3} & \\rho_{(x-\\kappa_1)_+^3 (x-\\kappa_2)_+^3} & \\sigma^2_{(x - \\kappa_2)_+^3}
0 & 0 & 0 & \\rho_{x^3 (x - \\kappa_3)_+^3} & \\rho_{(x - \\kappa_1)_+^3 (x - \\kappa_3)_+^3} & \\rho_{(x - \\kappa_2)_+^3 (x - \\kappa_3)_+^3} & \\sigma^2_{(x - \\kappa_3)_+^3} """
lines =
@certifiedwaif
certifiedwaif / gist:ed21b83af388a53558614b008c4a0363
Created January 24, 2019 22:32
Does anyone know how to resolve this error?
> library(devtools)
> test()
Loading blma
Error in processx::run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), :
System command error
#!/bin/sh
sudo apt install -y build-essential
sudo apt install -y git
sudo apt install -y zlib1g-dev
sudo apt install -y libxml2-dev
sudo apt install -y gfortran
sudo apt install -y libclang-dev
@certifiedwaif
certifiedwaif / multinomial_regression.stan
Created July 6, 2021 23:14
Multinomial regression model
/*
This model is based on the multinomial model in Bayesian Data Analysis 3, p426.
I used the multinomial regression example from the Stan website
https://mc-stan.org/docs/2_27/stan-users-guide/multi-logit-section.html and
then modified it to match our model.
For this model to work, you need an up to date version of `rstan`, at least
2.26.2. Follow the instructions here: https://mc-stan.org/r-packages/ to
upgrade your `rstan` if you have an old version. You can check which version