Skip to content

Instantly share code, notes, and snippets.


Phillip Alday palday

View GitHub Profile
palday / glmm_disp.jl
Last active Feb 27, 2020
Tinkering with GLMMs with dispersion parameters
View glmm_disp.jl
using MixedModels, RCall, GLM
R"lexdec =";
R"lexdec$rt_raw = exp(lexdec$RT)";
R"ldform = rt_raw ~ 1 + Class * NativeLanguage + (1 | Subject) + (1 | Word)";
R"""summary(ldmod <- glmer(ldform, lexdec, family=Gamma(link="identity"),nAGQ=0))"""
lexdec = rcopy(R"lexdec");
ldform = @formula(rt_raw ~ 1 + Class * NativeLanguage + (1 | Subject) + (1 | Word));
palday / talldatasim.jl
Created Sep 28, 2019
Tall data test for MixedModels.jl
View talldatasim.jl
using Random, DataFrames, MixedModels, PooledArrays
gendata(n::Int, nID::Int, nested=true) = gendata(MersenneTwister(42), n, nID, nested)
function gendata(rng::AbstractRNG, n::Int, nID::Int, nested::Bool)
df = DataFrame(y = zeros(n),
w = rand(rng, n),
x = rand(rng, n),
z = rand(rng, n),
sex = CategoricalArray([randstring(rng,"mf",1) for ii in 1:n]),
group = CategoricalArray(rand(rng, 1:5, n)),
palday / beyond-cran.R
Last active Feb 11, 2016
Useful R packages for mixed effects models
View beyond-cran.R
packages.rforge <- c(
rforge.prefix <- c(
#! /usr/bin/python2
import sys
import codecs
from bibtexparser.bparser import BibTexParser
non_local_fields = ['address',
View server.R
shinyServer(function(input, output) {
output$distribution <- renderPlot({
palday /
Last active Dec 30, 2015
Potential regex bug in python -- why isn't "o'clock" part of the match for re.findall()?
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# License: CC-BY-NC-SA 3.0
import re
import codecs
# download kate_chopin_the_awakening_and_other_short_stories.txt
# from Project Gutenberg:
palday / atlas
Last active Dec 17, 2015
ATLAS for R on Debian and Ubuntu
View atlas
sudo apt-get build-dep atlas
sudo apt-get install build-essential dpkg-dev cdbs devscripts gfortran liblapack-dev liblapack-pic
sudo apt-get source atlas
cd atlas*
sudo fakeroot debian/rules custom
# set n equal to the number of cpus (including virtual HT cpus) minus one
for i in {0..n}; do sudo cpufreq-set -g performance -c$i; done
sudo fakeroot debian/rules custom
sudo apt-get install libatlas-base-dev libatlas-base
sudo dpkg -i libatlas3gf-*.de
palday / purge-null
Created Jan 29, 2013
A few ways to find and get rid of NULL bites in documents.
View purge-null
tr < file-with-nulls -d '\000' > file-without-nulls
sed 's/\x0//g' file-with-nulls > file-without-nulls
sed 's/\x0/ /g' file-with-nulls > file-without-nulls
grep -P '\000' < file-with-nulls >file-without-nulls
awk '/\000/ { print }'
palday / hg push-all
Created Jan 29, 2013
bash-fu to push all mercurial bookmarks
View hg push-all
hg bookmarks | awk '{if (NF == 3) print $2; else print $1;}' | xargs -n 1 hg push -f -B
palday /
Created Oct 4, 2012
Restore a damaged GRUB on Mac using rEFIt
#! /bin/bash
# prep and chroot into the existing system
sudo mkdir -p /mnt/root
sudo mount /dev/sda4 /mnt/root/
sudo mount -t proc none /mnt/root/proc/
sudo mount -o bind /dev /mnt/root/dev
sudo mount --bind /sys /mnt/root/sys
sudo chroot /mnt/root/ /bin/bash
You can’t perform that action at this time.