Skip to content

Instantly share code, notes, and snippets.

View gu-mi's full-sized avatar

Gu Mi gu-mi

  • Sanofi
  • Cambridge, MA
View GitHub Profile
@gu-mi
gu-mi / Visually-weighted regression.R
Created September 24, 2012 23:47 — forked from dsparks/Visually-weighted regression.R
Visually-weighted regression plot
# A simple approach to visually-weighted regression plots
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("ggplot2", "reshape2", "MASS")
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Generate some data:
nn <- 1000
myData <- data.frame(X = rnorm(nn),
@gu-mi
gu-mi / rej-sim.R
Created September 20, 2012 02:08
Reject the first 37% ?
## I came across a Chinese science blog which discusses an interesting stuff that girls should reject
## the first 37% (for 1/e = 36.79%) pursuers in her life. A little R simulation as outlined in the
## gist is shown below just for fun. In the snippet, m is the total number of boys you can choose.
## In other words, they are potential husband for you. Larger number means high "quality" but these
## numbers are randomly sampled, i.e., you don’t know whether the one who just walks into your life
## is your Mr. Right or not. You reject the first m/e people (probably without any reason...), where
## e is the Euler’s number, and choose from the rest of the m people. If you find any one of the
## remaning boys better than the best boy you saw earlier in the first m/e ones, then you choose that
## guy; otherwise, you have to make do with the last guy for the rest of your life...
@gu-mi
gu-mi / deseq-vs-edger.R
Created September 20, 2012 01:51 — forked from stephenturner/deseq-vs-edger.R
DESeq vs edgeR comparison
# Note: using the devel versions of both packages!
library(DESeq) # version 1.9.11
library(edgeR) # version 2.99.8
library(VennDiagram)
# Read in data ------------------------------------------------------------
## Use pasilla data
datafile = system.file( "extdata/pasilla_gene_counts.tsv", package="pasilla" )
datafile