Standardise given data, and calculate tScore.
Needs averages.py and dispersion.py
Standardise given data, and calculate tScore.
Needs averages.py and dispersion.py
#python version 3.3.3 | |
#needs averages.py(https://gist.github.com/shotahorii/8206127) | |
#and dispersion.py(https://gist.github.com/shotahorii/8207631) | |
import dispersion as disp | |
#transform x -> ax + b | |
#l: list of numbers, a,b: numbers | |
def transform(l,a,b): | |
return [a*l[i]+b for i in range(len(l))] | |
#standardise the data | |
#l: list of numbers | |
def standardise(l): | |
return transform(l,1/disp.stdDev(l),-1/disp.coef(l)) | |
#calculate tScore | |
#l: list of numbers | |
def tScore(l): | |
standardised = standardise(l) | |
return [10*standardised[i]+50 for i in range(len(l))] |