Skip to content

Bayesian partial correlations #301

Open
@JulianGaviriaL

Description

@JulianGaviriaL
  1. I obtain the following results from the Bayesian correlation test of "Sepal.Length", "Sepal.Width", "Petal.Length" (iris dataset):
require(easystats)
require(BayesFactor)
require(see)

d<-correlation(iris, select=c("Sepal.Length", "Sepal.Width", "Petal.Length"), bayesian = TRUE)

Parameter1 | Parameter2 | rho | 95% CI | pd | % in ROPE | Prior | BF

Sepal.Length | Sepal.Width | -0.11 | [-0.27, 0.04] | 91.62% | 44.38% | Beta (3 +- 3) | 0.509
Sepal.Length | Petal.Length | 0.86 | [ 0.82, 0.90] | 100%*** | 0% | Beta (3 +- 3) | 2.14e+43***
Sepal.Width | Petal.Length | -0.41 | [-0.54, -0.28] | 100%*** | 0% | Beta (3 +- 3) | 3.49e+05***

My aim is to compute bayesian partial correlations. I tried 2 different codes:

e<-correlation(iris, select=c("Sepal.Length", "Sepal.Width", "Petal.Length"), bayesian = TRUE,partial_bayesian = TRUE)
f<-correlation(iris, select=c("Sepal.Length", "Sepal.Width", "Petal.Length"), bayesian = TRUE,partial = TRUE, partial_bayesian = TRUE)

Which one yields the most reliable results?

e

Correlation Matrix (pearson-method)

Parameter1 | Parameter2 | rho | 95% CI | pd | % in ROPE | Prior | BF

Sepal.Length | Sepal.Width | -0.11 | [-0.25, 0.05] | 91.42% | 44.55% | Beta (3 +- 3) | 0.509
Sepal.Length | Petal.Length | 0.86 | [ 0.82, 0.90] | 100%*** | 0% | Beta (3 +- 3) | 2.14e+43***
Sepal.Width | Petal.Length | -0.41 | [-0.55, -0.28] | 100%*** | 0% | Beta (3 +- 3) | 3.49e+05***

Observations: 150

f

Correlation Matrix (pearson-method)

Parameter1 | Parameter2 | rho | 95% CI | pd | % in ROPE | Prior | BF

Sepal.Length | Sepal.Width | 0.57 | [ 0.45, 0.66] | 100%*** | 0% | Beta (3 +- 3) | 6.96e+11***
Sepal.Length | Petal.Length | 0.91 | [ 0.87, 0.93] | 100%*** | 0% | Beta (3 +- 3) | 2.81e+55***
Sepal.Width | Petal.Length | -0.65 | [-0.74, -0.56] | 100%*** | 0% | Beta (3 +- 3) | 4.73e+17***

Observations: 150

  1. I assume that the correlation value (rho) of "Sepal.Length" | Sepal.Width" is adjusted for the linear effect of "Petal.Length".
    2.a) How does it works when I have 4 or a greater number of variables?
    2.b) Would it be possible to determine which variable (either "Petal.Length" or "Petal.Width") controls the correlation between "Sepal.Length" | Sepal.Width"?

g<-correlation(iris, select=c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"), bayesian = TRUE)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions