def _null_terminate(self, s, encoding): if PY3: # have bytes not strings, so must decode null_byte = asbytes('\x00') try: s = s.lstrip(null_byte)[:s.index(null_byte)] except: pass return s.decode(encoding) else: null_byte = asbytes('\x00') try: return s.lstrip(null_byte)[:s.index(null_byte)] except: return s
def setup_class(self): #SAS case self.endog = dta3['Relief'] self.groups = dta3['Brand'] self.alpha = 0.05 self.setup_class_() #super(self, self).setup_class_() #CheckTuckeyHSD.setup_class_() self.meandiff2 = sas_['mean'] self.confint2 = sas_[['lower', 'upper']].view(float).reshape((3, 2)) self.reject2 = sas_['sig'] == asbytes('***')
def setup_class(self): #SAS case self.endog = dta3['Relief'] self.groups = dta3['Brand'] self.alpha = 0.05 self.setup_class_() #super(self, self).setup_class_() #CheckTuckeyHSD.setup_class_() self.meandiff2 = sas_['mean'] self.confint2 = sas_[['lower','upper']].view(float).reshape((3,2)) self.reject2 = sas_['sig'] == asbytes('***')
3 26.1 3 28.3 3 24.3 3 26.2 3 27.8''' ss5 = '''\ 2 - 3 4.340 0.691 7.989 *** 2 - 1 4.600 0.951 8.249 *** 3 - 2 -4.340 -7.989 -0.691 *** 3 - 1 0.260 -3.389 3.909 - 1 - 2 -4.600 -8.249 -0.951 *** 1 - 3 -0.260 -3.909 3.389 ''' #accommodate recfromtxt for python 3.2, requires bytes ss = asbytes(ss) ss2 = asbytes(ss2) ss3 = asbytes(ss3) ss5 = asbytes(ss5) dta = np.recfromtxt(BytesIO(ss), names=("Rust", "Brand", "Replication")) dta2 = np.recfromtxt(BytesIO(ss2), names=("idx", "Treatment", "StressReduction")) dta3 = np.recfromtxt(BytesIO(ss3), names=("Brand", "Relief")) dta5 = np.recfromtxt(BytesIO(ss5), names=('pair', 'mean', 'lower', 'upper', 'sig'), delimiter='\t') sas_ = dta5[[1, 3, 2]] from gwstatsmodels.stats.multicomp import (tukeyhsd, pairwise_tukeyhsd, MultiComparison)
3 26.1 3 28.3 3 24.3 3 26.2 3 27.8''' ss5 = '''\ 2 - 3 4.340 0.691 7.989 *** 2 - 1 4.600 0.951 8.249 *** 3 - 2 -4.340 -7.989 -0.691 *** 3 - 1 0.260 -3.389 3.909 - 1 - 2 -4.600 -8.249 -0.951 *** 1 - 3 -0.260 -3.909 3.389 ''' #accommodate recfromtxt for python 3.2, requires bytes ss = asbytes(ss) ss2 = asbytes(ss2) ss3 = asbytes(ss3) ss5 = asbytes(ss5) dta = np.recfromtxt(BytesIO(ss), names=("Rust","Brand","Replication")) dta2 = np.recfromtxt(BytesIO(ss2), names = ("idx", "Treatment", "StressReduction")) dta3 = np.recfromtxt(BytesIO(ss3), names = ("Brand", "Relief")) dta5 = np.recfromtxt(BytesIO(ss5), names = ('pair', 'mean', 'lower', 'upper', 'sig'), delimiter='\t') sas_ = dta5[[1,3,2]] from gwstatsmodels.stats.multicomp import (tukeyhsd, pairwise_tukeyhsd, MultiComparison) #import gwstatsmodels.sandbox.stats.multicomp as multi #print tukeyhsd(dta['Brand'], dta['Rust'])