This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(MCMCglmm) | |
library(mvtnorm) | |
# separate covariances for each sex | |
Rf <- matrix(c(1, .4, .4, 1), nrow=2) | |
Rm <- matrix(c(1, 0, 0, 1), nrow=2) | |
# Simulate correlated phenotypes | |
females <- data.frame(rmvnorm(100, mean=c(0, 0), sigma=Rf)) | |
males <- data.frame(rmvnorm(100, mean=c(0, 0), sigma=Rm)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> n <- nrow(CC) | |
> Q <- INLA:::inla.pc.bym.Q(border, scale.model=TRUE) | |
> u <- .2/.31 | |
> alpha <- .01 | |
> phi.u <- .5 | |
> phi.alpha <- 2/3 | |
> formula2 <- agr ~ age + sex + age:sex + | |
+ f(geo, model='bym2', graph=border, | |
+ constr=TRUE, scale.model=TRUE, | |
+ hyper=list(phi=list(prior='pc', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GCTA-power analysis | |
# see http://spark.rstudio.com/ctgg/gctaPower/ | |
# http://www.plosgenetics.org/article/info%3Adoi%2F10.1371%2Fjournal.pgen.1004269 | |
# Bivariate analysis (traits measured on different sets of individuals) | |
bivariate_2sample_power <- function (N1=4000, N2=4000, rG=0.5, h2_1=0.2, h2_2=0.2, varA=0.00002, alpha=0.05) { | |
# variance of genetic correlation (Equation 10) | |
var_rG <- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
java -jar /path/to/GenomeAnalysisTK.jar $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dat <- data.frame(obs=c(rep(0, times=100), rnorm(100, 10, 1))) | |
# observed data looks something like | |
hist(dat$obs) | |
# break into the zero-part and the normal part of the distribution | |
# observed zeros get zero for the first part, otherwise 1 | |
# observed zeros get NA for the second part, otherwise observed value | |
dat <- transform(dat, zero_part=ifelse(obs == 0, yes=0, no=1), | |
norm_part=ifelse(obs != 0, yes=obs, no=NA)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# | |
# boosty likes it like that: | |
# ~/dev/dir[master]$ # clean working directory | |
# ~/dev/dir[master⚡]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "⚡" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** caught bus error *** | |
address 0x8, cause 'non-existent physical address' | |
Traceback: | |
1: .C("MCMCglmm", as.double(data$MCMC_y), as.double(data$MCMC_y.additional), as.double(data$MCMC_liab), as.integer(mvtype), as.integer(length(data$MCMC_y)), as.integer(X@i), as.integer(X@p), as.double(X@x), as.integer(X@Dim), as.integer(length(X@x)), as.integer(Z@i), as.integer(Z@p), as.double(Z@x), as.integer(Z@Dim), as.integer(length(Z@x)), as.integer(A@i), as.integer(A@p), as.double(A@x), as.integer(A@Dim), as.integer(length(A@x)), as.double(MSsd), as.integer(id - 1), as.integer(dam - 1), as.integer(sire - 1), as.integer(PedDim), as.integer(Aterm), as.integer(nfl), as.integer(nrl), as.integer(update), as.integer(split - 1), as.integer(c(nG, nR)), as.double(GRinv), as.double(GRvpP), as.double(GRnpP), as.integer(nitt), as.integer(thin), as.integer(burnin), as.integer(c(pr, pl)), as.double(Loc), as.double(Var), as.double(PLiab), as.integer(data$MCMC_family.names), |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
survey_id | |
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
ARGV.first.split.each do |f| | |
article = URI.parse(f) | |
article.host = article.host + ".ezproxy.YOUR-INSTITUTION" | |
puts article.to_s | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Options for ggplot + opts(...) | |
# These don't seem to be documented on the web. Listed here for reference. | |
# list current setting | |
theme_get() | |
# Make a plot | |
g <- ggplot(...) | |
# Print the plot with options |
OlderNewer