Partial correlation, Non-parametric data

21 Views Asked by At

I am struggling to know how to conduct a partial correlation when data is not normally distributed...

I have tried this and it is giving me data (the code has worked), but is this how you would actually do it?

partial.r( 
data <- df[, c("X", "Y", "Z")], 
method = "spearman" 
)

Thanks!

1

There are 1 best solutions below

0
William Revelle On

The data frame is not specified, so it hard to know what you are trying to do.

However, given a dataset, df, that you want to find all (spearman) correlations partialed for all the other ones:

partial.r(data=df[, c("X", "Y", "Z")],method="spearman")

#or use formula input:

partial.r(X ~ Y - Z, data=df, method="spearman")

Which will find the correlation between X and Y partialling out Z.