Skip to content

Instantly share code, notes, and snippets.

Monte-Carlo Permutation Testing

Near the end of my first statistics class, I was introduced to the concept of a hypothesis test: given two sample sets, determine the probability that they were drawn from the same population. If this is less than your desired p-value (typically 5% or less, depending on your field), you can reject the [null-hypothesis][1] and accept the alternative hypothesis that the two samples are indeed from different populations.

This was presented to me in the context of social sciences, but it comes up in

@dvanhorn
dvanhorn / tweet.rkt
Last active May 10, 2021 13:18
Tweet from Racket
#lang racket
(provide tweet! (struct-out oauth) current-oauth)
(require (only-in racket/random crypto-random-bytes)
json
net/url
(only-in net/uri-codec [uri-unreserved-encode %])
web-server/stuffers/hmac-sha1
(only-in net/base64 base64-encode))
;; tweet! : String -> JSON
@alexhanna
alexhanna / social-science-programming.md
Last active March 14, 2024 11:05
Notes on social science programming principles
  1. Code and Data for the Social Sciences: A Practitioner’s Guide, Gentzkow and Shapiro.
  2. Good enough practices in scientific computing, Wilson et al.
  3. Best Practices for Scientific Computing, Wilson et al.
  4. Principled Data Processing, Patrick Ball.
  5. The Plain Person’s Guide to Plain Text Social Science, Healy.
  6. Avoiding technical debt in social science research, Toor.
These code snippets have been tested on R 3.1.0 and Mac OS 10.9.3. They presumably do *not* work on R 2.X!
## Enter these commands in the Mac OS Terminal
# use faster vecLib library
cd /Library/Frameworks/R.framework/Resources/lib
ln -sf /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib libRblas.dylib
# return to default settings
cd /Library/Frameworks/R.framework/Resources/lib