python 方差分析
A common method in experimental psychology is within-subjects designs. One way to analysis the data collected using within-subjects designs are using repeated measures ANOVA. I recently wrote a post on how to conduct a repeated measures ANOVA using Python and rpy2. I wrote that post since the great Python package statsmodels do not include repeated measures ANOVA. However, the approach using rpy2 requires R statistical environment installed. Recently, I found a python library called pyvttbl whith which you can do within-subjects ANOVAs. Pyvttbl enables you to create multidimensional pivot tables, process data and carry out statistical tests. Using the method anova on pyvttbl’s DataFrame we can carry out repeated measures ANOVA using only Python.
实验心理学中的一种常见方法是受试者内部设计 。 分析使用受试者内部设计收集的数据的一种方法是使用重复测量方差分析 。 我最近写了一篇关于如何使用Python和rpy2进行重复测量方差分析的文章 。 我写这篇文章是因为出色的Python软件包statsmodels不包含重复测量方差分析。 但是,使用rpy2的方法需要安装R统计环境。 最近,我发现了一个名为pyvttbl的python库,您可以在主题内进行方差分析。 Pyvttbl使您可以创建多维数据透视表,处理数据并进行统计测试。 使用pyvttbl的DataFrame上的方差分析方法,我们可以仅使用Python进行重复测量方差分析。
为什么在主题设计中? (Why within subject designs?)
There are, at least, two of the advantages using within-subjects design. First, more information is obtained from each subject in a within-subjects design compared to a between-subjects design. Each subject is measured in all conditions, whereas in the between-subjects design, each subject is typically measured in one or more but not all conditions. A within-subject design thus requires fewer subjects to obtain a certain level of statistical power. In situations where it is costly to find subjects this kind of design is clearly better than a between-subjects design. Second, the variability in individual differences between subjects is removed from the error term. That is, each subject is his or her own control and extraneous error variance is reduced.
使用主题内设计至少有两个优点。 首先,与受试者之间的设计相比,受试者内部设计可从每个受试者获得更多信息。 在所有条件下对每个对象进行测量,而在对象间设计中,通常在一个或多个但不是所有条件下对每个对象进行测量。 因此,受试者内部的设计需要较少的受试者来获得一定水平的统计能力。 在找不到主题的成本很高的情况下,这种设计显然比主题间设计更好。 第二,从误差项中消除了受试者之间个体差异的变异性。 即,每个对象都是他或她自己的控制,并且减少了无关的误差方差。