Open
Description
Hello,
Many thanks for your easystats project!
In the latest version of correlation on CRAN, I encounter an unexpected behavior when including factors:
mtcars$am <- factor(mtcars$am)
correlation::correlation(mtcars[, c("am", "mpg")], include_factors=TRUE)
Parameter1 | Parameter2 | r | 95% CI | t | df | p | Method | n_Obs
----------------------------------------------------------------------------------------
am.0 | am.1 | -1.00 | [-1.00, -1.00] | -Inf | 30 | < .001 | Pearson | 32
am.0 | mpg | -0.60 | [-0.78, -0.32] | -4.11 | 30 | < .001 | Pearson | 32
am.1 | mpg | 0.60 | [ 0.32, 0.78] | 4.11 | 30 | < .001 | Pearson | 32
I was expecting a biserial correlation of am
with mpg
like here:
mtcars$am <- as.numeric(factor(mtcars$am))
correlation::correlation(mtcars[, c("am", "mpg")], include_factors=TRUE)
Parameter1 | Parameter2 | r | 95% CI | t | df | p | Method | n_Obs
------------------------------------------------------------------------------------
am | mpg | 0.60 | [0.32, 0.78] | 4.11 | 30 | < .001 | Pearson | 32
Do I anything wrong here? Is this behavior expected?
Many thanks for your help!