pingouin.ancova

pingouin.
ancova
(data=None, dv=None, between=None, covar=None)[source] ANCOVA with one or more covariate(s).
 Parameters
 data
pandas.DataFrame
DataFrame. Note that this function can also directly be used as a Pandas method, in which case this argument is no longer needed.
 dvstring
Name of column containing the dependant variable.
 betweenstring
Name of column containing the between factor.
 covarstring or list
Name(s) of column(s) containing the covariate.
 data
 Returns
 aovDataFrame
ANCOVA summary
'Source' : Names of the factor considered 'SS' : Sums of squares 'DF' : Degrees of freedom 'F' : Fvalues 'punc' : Uncorrected pvalues
See also
anova
Oneway and Nway ANOVA
Notes
Analysis of covariance (ANCOVA) is a general linear model which blends ANOVA and regression. ANCOVA evaluates whether the means of a dependent variable (dv) are equal across levels of a categorical independent variable (between) often called a treatment, while statistically controlling for the effects of other continuous variables that are not of primary interest, known as covariates or nuisance variables (covar).
Note that in the case of one covariate, Pingouin will use a builtin function. However, if there are more than one covariate, Pingouin will use the statsmodels package to compute the ANCOVA.
Rows with missing values are automatically removed (listwise deletion).
Examples
1. Evaluate the reading scores of students with different teaching method and family income as a covariate.
>>> from pingouin import ancova, read_dataset >>> df = read_dataset('ancova') >>> ancova(data=df, dv='Scores', covar='Income', between='Method') Source SS DF F punc 0 Method 571.030045 3 3.336482 0.031940 1 Income 1678.352687 1 29.419438 0.000006 2 Residual 1768.522365 31 NaN NaN
2. Evaluate the reading scores of students with different teaching method and family income + BMI as a covariate.
>>> ancova(data=df, dv='Scores', covar=['Income', 'BMI'], between='Method') Source SS DF F punc 0 Method 552.284 3 3.233 0.036113 1 Income 1573.952 1 27.637 0.000011 2 BMI 60.014 1 1.054 0.312842 3 Residual 1708.509 30 NaN NaN