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(R2WinBUGS) | |
library(coda) | |
setwd("~/R") | |
eps <- 1.0E-4 | |
N <- 10 | |
K <- 2 | |
data1 <- list( |
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("rjson") | |
scw <- function(D,eta,verbose=F) { | |
phi <- qnorm(eta) | |
psi <- 1+phi^2/2 | |
zeta <- 1+phi^2 | |
mu <- rep(0,D) | |
sigma <- diag(D) | |
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
<html> | |
<body> | |
<script src="./processing.min.js"></script> | |
<canvas datasrc="./mondorian.pjs"></canvas> | |
</body> | |
</html> |
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
import java.io.*; | |
import java.util.*; | |
public class ApplesAndPears { | |
private int[][][] sb; | |
public int getArea(String[] board, int K) { | |
int N = board.length; | |
sb = new int[3][N][N]; |
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
package | |
{ | |
import flash.display.MovieClip; | |
import flash.display.Sprite; | |
import flash.display.Bitmap; | |
import flash.text.StyleSheet; | |
import flash.text.TextField; | |
import flash.geom.Transform; | |
import flash.geom.Matrix; | |
import flash.events.*; |
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
Ad | Imp | Clk | |
---|---|---|---|
A | 300 | 6 | |
B | 500 | 14 | |
C | 150 | 5 |
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
1 | 5.1 | 3.5 | 1.4 | 0.2 | setosa | |
---|---|---|---|---|---|---|
2 | 4.9 | 3 | 1.4 | 0.2 | setosa | |
3 | 4.7 | 3.2 | 1.3 | 0.2 | setosa | |
4 | 4.6 | 3.1 | 1.5 | 0.2 | setosa | |
5 | 5 | 3.6 | 1.4 | 0.2 | setosa | |
6 | 5.4 | 3.9 | 1.7 | 0.4 | setosa | |
7 | 4.6 | 3.4 | 1.4 | 0.3 | setosa | |
8 | 5 | 3.4 | 1.5 | 0.2 | setosa | |
9 | 4.4 | 2.9 | 1.4 | 0.2 | setosa | |
10 | 4.9 | 3.1 | 1.5 | 0.1 | setosa |
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
sr <- function() source('lm_test.R') | |
make_data <- function(n,sd=0.4) { | |
x <- seq(0,2*pi,length=n) | |
y <- sin(x) + rnorm(n,0,sd) | |
return(data.frame(x=x,y=y)) | |
} | |
my_test <- function(d,m) { | |
z <- lm(y~poly(x,m),data=d) |
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
# resulting image is | |
# http://dl.dropbox.com/u/15259519/images/CLT_sim.png | |
sr <- function() source("CLT_test.R") | |
sim1 <- function(n,m=500,c=30) { | |
mat <- matrix(runif(m*n),c(m,n)) | |
res <- (rowSums(mat)-n*0.5)/sqrt(n/12) | |
hist(res,nclass=c,main='',xlab=sprintf("N=%d, trial num=%d",n,m)) | |
} |
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
use JSON; | |
use Encode; | |
if (@ARGV<1) { print "usage: $0 user_id [page]\n"; exit(0); } | |
my $url="http://twitter.com/statuses/user_timeline.json?id=$ARGV[0]"; | |
$url.="\\&page=$ARGV[1]" if ($ARGV[1]); | |
open(F,"wget $url -O -|");my $j=<F>;close(F); |