Pingouin

Pingouinl are adequate for your analysis. Click on the desired flowchart to view a full scale image with hyperlinks.

Table of Contents

One-way ANOVA

Example code

import pingouin as pg

# Load an example dataset comparing pain threshold as a function of hair color
df = pg.read_dataset('anova')

# 1\. This is a between subject design, so the first step is to test for equality of variances
groups = df['Hair color'].unique()
a, b, c, d = [df.groupby('Hair color')['Pain threshold'].get_group(g).values for g in groups]
equal_var, pval = pg.homoscedasticity(a, b, c, d)

# 2\. If the groups have equal variances, we can use a regular one-way ANOVA
pg.anova(data=df, dv='Pain threshold', between='Hair color')

# 3\. If there is a main effect, we can proceed to post-hoc Tukey test
pg.pairwise_tukey(data=df, dv='Pain threshold', between='Hair color')

Correlation

Example code

import pingouin as pg
import seaborn as sns

# Load an example dataset with the personality scores of 500 participants
df = pg.read_dataset('pairwise_corr')

# 1.Test for bivariate normality
print(multivariate_normality(df[['Neuroticism', 'Openness']]))

# 1bis. Visual inspection with a histogram + scatter plot
sns.jointplot(data=df, x='Neuroticism', y='Openness', kind='reg')

# 2\. If the data have a bivariate normal distribution and no clear outlier(s), we can use a regular Pearson correlation
pg.corr(df['Neuroticism'], df['Openness'], method='pearson')

Non-parametric

Example code

import pingouin as pg

# Load an example dataset comparing pain threshold as a function of hair color
df = pg.read_dataset('anova')

# There are 4 independent groups in our dataset, we'll therefore use the Kruskal-Wallis test:
pg.kruskal(data=df, dv='Pain threshold', between='Hair color')
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 字符串 1.什么是字符串 使用单引号或者双引号括起来的字符集就是字符串。 引号中单独的符号、数字、字母等叫字符。 ...
    mango_2e17阅读 7,543评论 1 7
  • 《闭上眼睛才能看清楚自己》这本书是香海禅寺主持贤宗法师的人生体悟,修行心得及讲学录,此书从六个章节讲述了禅修是什么...
    宜均阅读 10,133评论 1 25
  • 前言 Google Play应用市场对于应用的targetSdkVersion有了更为严格的要求。从 2018 年...
    申国骏阅读 64,689评论 15 98
  • 第七章:理性的投资观 字数: 1.投资要围绕目的进行 投资的目的是为了挣钱。投资的除了金钱还有时间和精力也是一种投...
    幸福萍宝阅读 3,365评论 1 2
  • 本文转载自微信公众号“电子搬砖师”,原文链接 这篇文章会以特别形象通俗的方式讲讲什么是PID。 很多人看到网上写的...
    这个飞宏不太冷阅读 6,911评论 2 15