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
# FIXME: There's a bug where if data in one of the groups is shorter than the others, spurious predictions | |
# from the segmented linear model will be repeated until the number of predictions is the same as the other | |
# data sequences. | |
panel.segmented_lm <- function(x, y, groups, subscripts, ...) | |
{ | |
g = groups[subscripts] | |
for (group in levels(g)) { | |
x2 = x[g==group] | |
y2 = y[g==group] |
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
# Recode and score variables ---- | |
# Input: Long data set | |
# Output: Long data set, with fat, fibre and psychosocial score variables consistently | |
# coded at baseline, three months and twelve months. | |
# Explanation: Different people entered the baseline and follow-up survey data, and they | |
# didn't talk to each other. So the data for some questions got coded differently at | |
# different timepoints. This is very confusing, and means we can't meaningfully compare | |
# the data, so I'm writing this code to fix it up. | |
make_coding_consistent = function(data) | |
{ |
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
cronbach_alpha = function(formula, data=NULL) | |
{ | |
terms = terms(formula, data=data) | |
variables = attr(terms, "variables") | |
var_list = eval(variables, envir=data) | |
var_mat = t(laply(var_list, identity)) | |
var_mat = var_mat[complete.cases(var_mat),] | |
response_idx = attr(terms, "response") | |
response = var_mat[,response_idx] | |
covariates = var_mat[,-response_idx] |
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
The command was find /mnt/Seagate_Expansion4_No2 -name \*sra\* -print0 | parallel --null ./sra_to_fastq.sh {} | |
The script sra_to_fastq.sh contains: | |
---- | |
#!/bin/bash -x | |
outdir=/home/mark/data | |
echo $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
trace: f.GVA(vtheta_prime, vy, vr, mC, mSigma.inv, gh, mR, Rinds, Dinds) | |
f.VGA: f 25441.43 vmu 4.18073 0.31266 -0.77725 -1.0205 -0.96467 -0.75745 -0.26577 0.08923 0.63935 0.61445 0.60797 0.30834 -0.23776 -0.40567 diag(mR) 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 | |
trace: f.GVA(vtheta_prime, vy, vr, mC, mSigma.inv, gh, mR, Rinds, Dinds) | |
f.VGA: f 25441.43 vmu 4.18073 0.31266 -0.77725 -1.0205 -0.96467 -0.75745 -0.26577 0.08923 0.63935 0.61445 0.60797 0.30834 -0.23776 -0.40567 diag(mR) 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 | |
trace: f.GVA(vtheta_prime, vy, vr, mC, mSigma.inv, gh, mR, Rinds, Dinds) | |
f.VGA: f 25441.43 vmu 4.18073 0.31266 -0.77725 -1.0205 -0.96467 -0.75745 -0.26577 0.08923 0.63935 0.61445 0.60797 0.30834 -0.23776 -0.40567 diag(mR) 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 0.04448 | |
trace: f.GVA(vtheta |
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
-- hw3.hs | |
module Main where | |
import System.Random | |
import Data.Vector.Unboxed hiding (forM_, take, unfoldr, map) | |
import Data.Vector.Unboxed.Mutable hiding (take) | |
import Data.List | |
import Control.Monad.ST (runST) | |
import Control.Monad (forM_) | |
import Prelude hiding (read) |
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
greycode <- function(p) | |
{ | |
A <- matrix(c(0,1),2,1) | |
if (p!=1) { | |
for (i in 2:p) { | |
P <- nrow(A) | |
inds <- rev(1:P) | |
A1 <- matrix(c(rep(0,P),rep(1,P)),2*P,1) | |
A2 <- rbind(A,matrix(A[inds,],nrow(A),ncol(A))) | |
A <- cbind(A1,A2) |
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
#include <algorithm> | |
#include <iostream> | |
#include <climits> | |
#include <vector> | |
#include <algorithm> | |
#include <string> | |
// #include <boost/dynamic_bitset.hpp> | |
using namespace std; | |
// using namespace boost; |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Final//EN"> | |
<html><head> | |
<title>HardInfo (0.5.1) System Report</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<style> | |
body { background: #fff } | |
.title { font: bold 130% serif; color: #0066FF; padding: 30px 0 10px 0 } | |
.stitle { font: bold 100% sans-serif; color: #0044DD; padding: 30px 0 10px 0 } | |
.sstitle{ font: bold 80% serif; color: #000000; background: #efefef } | |
.field { font: 80% sans-serif; color: #000000; padding: 2px; padding-left: 50px } |
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(purrr) | |
vp <- c(10, 20, 50, 100, 500, 1000) | |
vn <- c(1.1, 1.25, 1.5, 2, 5, 10) | |
vR2 <- seq(from=0.00, to=1.00, by = 1e-2) | |
df <- map(vp, function(p) { | |
map(vn, function(n) { | |
map(vR2, function(R2) {c(p*n, p, R2)}) | |
}) | |
}) %>% as.data.frame %>% t |
OlderNewer