News

New paper! in the American Naturalist

Friday, July 31, 2020

Statistics: Partial correlation

Partial correlation can be used when variables may be dependent of each other.
(This link is useful)

"The basic idea in partial and semipartial correlation is to examine the correlations among residuals (errors of prediction). If we regress variable X on variable Z, then subtract X' from X, we have a residual e. This e will be uncorrelated with Z, so any correlation X shares with another variable Y cannot be due to Z."

Python package that has functions for partial correlation -- pingouin
Works well with pandas dataframes.
df = pd.DataFrame
e.g. df.pcorr() gives partial correlation between each pair of data in column. 
For other statistics such as p-values or more robust functions, use pingouin.partial_corr()