Skip to content
{{ message }}

Instantly share code, notes, and snippets.

# John Myles White johnmyleswhite

Created Aug 28, 2015
Stats Quotes
View stats_woes.txt
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
 "We are struck by the fact that in the social and behavioral sciences, epidemiology, economics, market research, engineering, and even applied physics, statistical methods are routinely used to justify causal inferences from data not obtained from randomized experiments, and sample statistics are used to predict the effects of policies, manipulations or experiments. Without these uses the profession of statistics would be a far smaller business. It may not strike many professional statisticians as particularly odd that the discipline thriving from such uses assures its audience that they are unwarranted, but it strikes us as very odd indeed."
Last active Aug 29, 2015
Counterexamples in Statistics
View mean.md

# The sample mean is never exactly equal to the true mean when the true mean is irrational

Let D be any distribution over the integers. Suppose that the first moment exists for D and is an irrational number.

In this case, the sample mean is never exactly equal to the true mean because the sample mean is always a rational number.

This is simple to prove: the sample mean is always a sum of integers divided by the number of samples, which is always an integer.

Created Feb 3, 2014
Scope reification in R
View mutate.R
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
 foo <- function(frame_number) { assign("frame_number", -1, envir = sys.frame(frame_number)) } bar <- function() { frame_number <- sys.nframe() print(frame_number) foo(frame_number)
Created Feb 4, 2014
FTW
View ftw.R
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
 a <- 1 b <- 2 ftw <- function() { vars <- ls(envir = .GlobalEnv) rm(list = vars, envir = .GlobalEnv) } ftw()
Created Feb 11, 2014
Abstract for UC Davis Talk
View abstract.md

# Julia and Statistical Computing

Julia is a new language for technical computing. The language is designed to solve the "two language problem", in which scientists prototype code in a higher-level language like R and then rewrite parts (or all) of their code in a lower-level language like C. Julia strives to expose a set of basic abstractions that allow programmers to transition easily between quick-and-dirty prototype code and production-quality code.

Created Mar 2, 2014
Toy RSA implementation in Julia based on Matt Might's implementation in Scheme
View rsa.jl
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
 # --- # Author: Matthew Might # Translator: John Myles White # Site: http://matt.might.net/articles/implementation-of-rsa-public-key-cryptography-algorithm-in-scheme-dialect-of-lisp/ # --- # --- # Mathematical routines # ---
Last active Aug 29, 2015
Poisson matrix factorization: a naive implementation using dense arrays
View poissonmf.jl
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
 using Distributions const Ψ = digamma # RNG function generate( a::Real, b::Real, c::Real, d::Real,
Last active Aug 29, 2015
Bernoulli matrix factorization
View README.md

## BinaryMF

Attempt to factor a binary matrix, $D$, under the assumption that entries are IID Bernoulli draws, conditional on the value of a link-transformed linear predictor, $\mathbb{E}[D_{i, j}] = I(\mu + a_i + b_j + X_{i}^{T} Y_{j})$, where $I$ is the inverse logit link function.

Because of non-identifiability problems, we use a consistent $\mathcal{N}(0, \sigma^2)$ prior over all parameters in the model

Last active Aug 29, 2015
Function Evaluation in Julia and R: Example 1.5 from SICP
View 01-bitdiddle.jl
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
 # Ben Bitdiddle's demonstration that Julia uses applicative-order evaluation p() = p() # p (generic function with 1 method) test(x, y) = x == 0 ? 0 : y # test (generic function with 1 method)
Last active Aug 29, 2015
Factor arithmetic
View factor_mult.R
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
 > x <- 1 > f <- factor(x) > f[1] * f[1] [1] NA Warning message: In Ops.factor(f[1], f[1]) : * not meaningful for factors > p <- f[1] * f[1] Warning message: In Ops.factor(f[1], f[1]) : * not meaningful for factors > class(p)