python笔记:8.2.3 非参数检验的基本问题_游程检验

 

# -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 14:26:22 2019

@author: User
"""

# 《Python数据分析基础》中国统计出版社

import numpy as np
from scipy import stats
import pandas as pd
import statsmodels.api as sm
#import statsmodels.formula.api as smf
#import matplotlib.pyplot as plt
#from statsmodels.stats.multicomp import pairwise_tukeyhsd
#from statsmodels.graphics.api import interaction_plot
from matplotlib.font_manager import FontProperties
myfont=FontProperties(fname='data\msyh.ttc')

runs = pd.read_csv(u'data/ch8/runs.csv',encoding = "gbk")

print("\n sm.stats.runstest_1samp:")
t = sm.stats.runstest_1samp(np.asarray(runs['economics']), cutoff='median')
print(t)


运行:

 sm.stats.runstest_1samp:
(-1.3394253515905177, 0.18043224087490017)

你可能感兴趣的:(python学习)