Skip to content

Instantly share code, notes, and snippets.

View timflutre's full-sized avatar

Timothée Flutre timflutre

View GitHub Profile
@timflutre
timflutre / test_qsub_subprocess.py
Created March 15, 2016 08:59
submit job via pipe to SGE's qsub using python subprocess
#!/usr/bin/env python
import sys
import subprocess
case = int(sys.argv[1])
queue = "all.q"
jobName = "test%i" % case
cmd = "echo %i; date; sleep 2; date" % case
echoArgs = ["echo", "-e", "'%s'" % cmd]
@timflutre
timflutre / bayes-sampling_simple-normal.R
Last active May 8, 2016 12:51
learn how to use various R packages to perform Bayesian inference via sampling
## Goal of this document: learn how to use various R packages to perform
## Bayesian inference via sampling
## Author: Timothée Flutre (INRA)
## I. Model
## sub-section: details about Ga and InvGa distributions
## II. Simulations
## III. Inference via sampling
## III.1 Fit with OpenBUGS (many explanations)
## sub-section: detailed diagnostics with "coda" and "mcmcse"
@timflutre
timflutre / animal-model-basic.R
Last active March 20, 2024 05:13
compare lme4 and rrBLUP to fit an "animal model" (LMM) in R
## Model: a specific kind of linear mixed model known as "animal model" by geneticists
## y = mu 1_N + X b + Z u + e = W a + Z u + e
## y is N x 1; X is N x P; Z is N x Q; W is N x (P+1)
## u ~ Norm_Q(0, sigma_u^2 A); e ~ Norm_N(0, sigma^2 I_N)
## Goal of this document: estimate the variance components sigma_u^2 and sigma^2
## 1) simulate some data
## 2) fit the model above using the package rrBLUP (v4.3, on CRAN)
## 3) fit the model above using lme4 (v1.7, on CRAN)
## Author: Timothée Flutre (INRA)