Skip to content

Instantly share code, notes, and snippets.

@josef-pkt
josef-pkt / try_distr_rvs.py
Created June 3, 2012 17:49
Random variable by subclassing distribution
# -*- coding: utf-8 -*-
"""Random variable by subclassing distribution
Created on Sun Jun 03 10:43:04 2012
Author: Josef Perktold
adjusted example from mailing list
generic random number generation given only the pdf is slooooow
@josef-pkt
josef-pkt / example_gls_try4.ipynb
Created September 22, 2012 03:40
ipynb formatting
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
"""Avoid Pickle problems with an instance method
Created on Tue Dec 18 15:22:19 2012
Author: Josef Perktold
"""
import pickle
@josef-pkt
josef-pkt / try_scoreatpercentiles.py
Last active December 10, 2015 02:48
scoreatpercentiles vectorized
# -*- coding: utf-8 -*-
"""scoreatpercentiles vectorized
Created on Mon Dec 24 09:29:31 2012
Author: Josef Perktold
"""
import numpy as np
"""
=========================================================
circular data analysis functions
=========================================================
"""
# Authors : Anne Kosem and Alexandre Gramfort
# License : Simplified BSD
@josef-pkt
josef-pkt / ex_kernel_regression3.py
Last active December 10, 2015 14:39
script to try out Censored kernel regression now left censored with reverse indexing to undo sort
# -*- coding: utf-8 -*-
"""script to try out Censored kernel regression
Created on Wed Jan 02 13:43:44 2013
Author: Josef Perktold
"""
import numpy as np
import statsmodels.nonparametric.api as nparam
@josef-pkt
josef-pkt / try_mixed_repeated.py
Created February 11, 2013 12:35
example for OneWayMixed (doesn't work)
# Worker Machine score
ss = '''\
1 1 A 52.0
2 1 A 52.8
3 1 A 53.1
4 2 A 51.8
5 2 A 52.8
@josef-pkt
josef-pkt / try_mixed_repeated_0.py
Created February 11, 2013 12:44
another try on OneWayMixed (units are machine intersection worker)
# Worker Machine score
ss = '''\
1 1 A 52.0
2 1 A 52.8
3 1 A 53.1
4 2 A 51.8
5 2 A 52.8
import numpy as np
from numpy import asarray, add, rollaxis, sort, arange
def percentile(a, q, limit=None, interpolation='linear', axis=None,
out=None, overwrite_input=False):
"""
Compute the qth percentile of the data along the specified axis.
Returns the qth percentile of the array elements.
@josef-pkt
josef-pkt / mc_mannwhitenyu.py
Created February 17, 2013 02:08
A quick check for size and power of mannwhitneyu if data is poisson
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 20:52:22 2013
Author: Josef Perktold
"""
import numpy as np
from scipy import stats