Skip to content

Instantly share code, notes, and snippets.

@isomorphisms
isomorphisms / brains.R
Last active December 21, 2015 16:58
animals sorted by brain size
require(ggplot2); data(msleep); attach(msleep)
animal.brains <- na.omit( data.frame( name, round( brainwt / bodywt * 100, 1) ))
names(list) <- c("animal", "how.brainy")
@isomorphisms
isomorphisms / USD.R
Created July 20, 2013 03:36
$USDX or $USD:IND, the USD index basket. #forex #currency #oanda #FRED
# This computes the USD index which is the "broad measure of the US Dollar against a BASKET of currencies" rather than against a particular pair
getFX(c("USD/EUR", "USD/JPY", "USD/GBP", "USD/CAD", "USD/SEK", "USD/CHF"))
# The formula comes from ICE markets https://www.theice.com/publicdocs/futures_us/ICE_Dollar_Index_FAQ.pdf
e <- .576
y <- .136
s <- .119
l <- .091
@isomorphisms
isomorphisms / 2^2^2^2^2
Created March 14, 2013 19:58
2^2^2^2^2
$ bc -l
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
2^2
4
2^2^2
@isomorphisms
isomorphisms / significance.R
Last active December 11, 2015 17:09
magnitude (β) & significance (p) in regression analysis
par(col="#333333", lwd=3, pch=20, ylim=c(0,25), ylab="", xlab="",bty="n") #ylim,ylab,xlab won't run here; just reminders
#low β and confident in it
x <- runif(20,max=20)
y <- x + rnorm(20,0,.5)
plot(x,y, xlab="", ylab="", col=rgb(.1,.1,.5,.5), ylim=c(0,25), main="very confident (low p) and large response (high β)")
abline(coef(lm(y~x)), col="blue", lwd=2)
rug(x, col=rgb(.1,.1,.5)); rug(y, col=rgb(.1,.1,.5),side=2)
@isomorphisms
isomorphisms / .ttytterrc.pl
Created August 1, 2012 11:16
my .ttytterrc
vcheck=1
slowpost=2
ansi=1
ssl=1
dostream=1
newline=1
urlopen="w3m %U"
track='#Rstats #neo4j'
@isomorphisms
isomorphisms / awful.html
Created July 30, 2012 19:03
my blog's awful css
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>{block:SearchPage}Search results for "{SearchQuery}" &bull; {/block:SearchPage}{block:PostSummary}{PostSummary} &bull; {/block:PostSummary} see things differently </title>
@isomorphisms
isomorphisms / TTYtter.perl
Created July 27, 2012 09:38
TTYtter with /spam and /shoosh
#!/usr/bin/perl -s
#########################################################################
#
# TTYtter v2.0 (c)2007-2012 cameron kaiser (and contributors).
# all rights reserved.
# http://www.floodgap.com/software/ttytter/
#
# distributed under the floodgap free software license
# http://www.floodgap.com/software/ffsl/
#
@isomorphisms
isomorphisms / F11.R
Created June 26, 2012 08:33
the sporadic Janko group J1 in R #Rstats
F11 <- function(x) {
#numbers come in as floats
as.integer(x)
#error checking
stopifnot( is.integer(x) )
#struct
structure(x %% 11, class="F11")
}
@isomorphisms
isomorphisms / .tmux.conf.bash
Created May 31, 2012 17:49
my tmux configuration
# You're meant to read through this
# configuraton file rather than simply
# copying it to your home directory.
#
# There are some places where you're
# meant to uncomment something if you
# want to use it in your TMUX.
#
# I hope it's readable.
#
@isomorphisms
isomorphisms / gist:1783240
Created February 9, 2012 21:08
How to generate patterned matrices in R and format then in LaTeX
> require(Hmisc)
> require(sfsmisc)
> k.3 <- matrix(
c(
-2, 1, 0,
-1, 2, -1,
0, -1, 2),
nrow=3, ncol=3