Skip to content

Instantly share code, notes, and snippets.

@josef-pkt
josef-pkt / dunn.py
Last active August 29, 2015 14:10 — forked from alimuldal/dunn.py
import numpy as np
from scipy import stats
from itertools import combinations
from statsmodels.stats.multitest import multipletests
from statsmodels.stats.libqsturng import psturng
import warnings
def kw_dunn(groups, to_compare=None, alpha=0.05, method='bonf'):
"""
@josef-pkt
josef-pkt / nemenyi.py
Last active August 29, 2015 14:10 — forked from alimuldal/nemenyi.py
import numpy as np
from scipy import stats
from itertools import combinations
from statsmodels.stats.multitest import multipletests
from statsmodels.stats.libqsturng import psturng
import warnings
def kw_nemenyi(groups, to_compare=None, alpha=0.05):
"""
@josef-pkt
josef-pkt / ci_within.py
Last active December 20, 2015 08:19 — forked from dengemann/ci_within.py
# Author Denis A. Engemann <d.engemann@gmail.com>
# Adjustments: Josef Perktold
#
# License: BSD (3-clause)
import numpy as np
import scipy.stats
import pandas as pd
def ci_within(df, indexvar, withinvars, measvar, confint=0.95,
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.
"""
=========================================================
circular data analysis functions
=========================================================
"""
# Authors : Anne Kosem and Alexandre Gramfort
# License : Simplified BSD
@josef-pkt
josef-pkt / scatter_fit.py
Created April 2, 2012 01:15
Plots a scatter plot of vectors x and y, also showing marginal histograms and least squares line fit. Sparklines are optionally displayed (relevant if the data are time series). "shs" in the name is shorthand for "Scatter plot with Histograms and Sparklin
#Copyright (c) 2011, Josh Hemann (hemann @ colorado . edu)
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
@josef-pkt
josef-pkt / stationary_block_bootstrap.py
Created April 2, 2012 01:14
Performs a stationary block bootstrap resampling of elements from a time series, or rows of an input matrix representing a multivariate time series.
#Copyright (c) 2011, Josh Hemann (hemann @ colorado . edu)
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
@josef-pkt
josef-pkt / empirical_likelihood.py
Created March 20, 2012 19:29 — forked from jseabold/empirical_likelihood.py
Empirical Likelihood with Moment Constraints
'''
Author: Skipper
https://gist.github.com/2109628
Josef: adjustments to example
'''
from statsmodels.base.model import LikelihoodModel
@josef-pkt
josef-pkt / multidim_digitize.py
Created December 22, 2011 21:37 — forked from daien/multidim_digitize.py
Build a regular grid and assigns each data point to a cell
'''
Author: Adrien Gaidon
https://gist.github.com/1509853
BSD on mailing list
Josef Perktold for numpy 1.5 compatibility
'''
from scipy import stats
class GaussianKernelDensityEstimation(object):
"""docstring for GaussianKernelDensityEstimation"""
def __init__(self):
self.gkde = None
def fit(self, X):
"""docstring for fit"""
self.gkde = stats.gaussian_kde(X.T)