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
#!/bin/bash | |
GIST_RECV_URL=http://gist.github.com/%s.txt; | |
GIST_POST_URL=http://gist.github.com/gists; | |
GIST_DEL_URL=http://gist.github.com/delete; | |
GIST_DESC_URL=http://gist.github.com/gists/%s/update_description; | |
GITHUB_USER=`git config --global github.user | tr -d \\n`; | |
GITHUB_TOKEN=`git config --global github.token | tr -d \\n`; | |
GETINDEX="gistfile1"; |
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
# Time-stamp: <2010-08-09 12:10:54 chl> | |
# | |
# Some illustrations of splines fitting. | |
# | |
# The example used throughout this script comes from | |
# Kooperberg & LeBlanc, Multivariate Nonparametric Regression, | |
# in _High-Dimensional Data Analysis in Cancer Research_ | |
# (Ed. X. Li and R. Xu), Chapter 3, p. 45. | |
# |
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
# Time-stamp: <2010-08-10 11:51:15 chl> | |
# | |
# Illustration of LASSO penalization in multiple regression. | |
# | |
# The exemple is largely inspired from Harezlak, Tchetgen | |
# and Li, Variable selection in regression -- Estimation, | |
# Prediction, Sparsity, Inference, | |
# in _High-Dimensional Data Analysis in Cancer Research_ | |
# (Ed. X. Li and R. Xu), Chapter 2, pp. 13--33. |
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 toy example to illustrate @chi-square question | |
# http://stats.stackexchange.com/questions/604/discriminant-analysis | |
# | |
# The basic idea is to fit a given model and then reuse the fitted values | |
# as new values to predict to check if: (1) parameters estimates remain | |
# identical, and (2) rough measure of goodness-of-fit increase. | |
# | |
set.seed(101) |
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
class Stack: | |
def __init__(self): | |
self.items = [] | |
def isEmpty(self): | |
return self.items == [] | |
def push(self, item): | |
self.items.append(item) | |
def pop(self): | |
return self.items.pop() | |
def peek(self): |
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
#!/usr/bin/env ruby | |
require("gsl") | |
x = 2.0 | |
P = GSL::Cdf::ugaussian_P(x); | |
printf("prob(x < %f) = %f\n", x, P); | |
Q = GSL::Cdf::ugaussian_Q(x); | |
printf("prob(x > %f) = %f\n", x, Q); |
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
#! /usr/bin/env ruby | |
require 'statsample' | |
sample=200 | |
a=sample.times.collect {rand}.to_scale | |
b=sample.times.collect {rand}.to_scale | |
c=sample.times.collect {rand}.to_scale | |
d=sample.times.collect {rand}.to_scale | |
ds={'a'=>a,'b'=>b,'c'=>c,'d'=>d}.to_dataset |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
int main(void) { | |
char * line = NULL; | |
size_t len = 0; |
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
#!/usr/bin/env python | |
from pylab import * | |
dt = 0.0005 | |
t = arange(0.0, 20.0, dt) | |
s1 = sin(2*pi*100*t) | |
s2 = 2*sin(2*pi*400*t) | |
# create a transient "chirp" | |
mask = where(logical_and(t>10, t>12), 1.0, 0.0) |
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
# Time-stamp: <2010-09-06 19:09:25 chl> | |
# | |
# Show multiple boxplot on the same page. | |
# Part of the code (esp. that concerned with making a bxp | |
# from scratch comes from P. Murrell. | |
# | |
#x <- replicate(50, sample(1:5, 500, rep=TRUE)) | |
x <- replicate(190, rnorm(500)) |
OlderNewer