Question regarding Means and Total scores in Partial Correlation Functions

Hey all,

I have a quick question, might seem kind of silly but I want to publish my code along with my manuscript for transparency so I want to make sure I'm not making a mistake. So I created a simulated dataframe here, if you want me to reprex I can but if you copy and paste that, it will create the dataframe. So I'm creating a vector, one with a total score and one with a mean score. And my question is, when calculating a partial correlation (or any correlation) in R, do I actually need to generate a mean score beforehand or does R or the pcor.test function handle this automatically. Because if you look at the results when running the p.cor.test values from the total score and mean score, they are identical. Long story short, can I just use the total score in this scenario?

Create a data frame with 15 rows and 5 numeric columns

data <- data.frame(
Column1 = seq(1, 15),
Column2 = rnorm(15),
Column3 = runif(15),
Column4 = rnorm(15, mean = 10, sd = 2),
Column5 = sample(1:100, 15),
Column6 = rnorm(15, mean = 12),
Column7 = rnorm(15),
Column8 = rnorm(15)

Calculate Totatscore and Meanscore

data$Totatscore <- data$Column1 + data$Column2 + data$Column3 + data$Column4 + data$Column5

data$Meanscore <- (data$Column1 + data$Column2 + data$Column3 + data$Column4 + data$Column5) / 5

pcor.test(data$Totatscore, data$Column8, list(data$Column6 + data$Column7), method = "pearson")

pcor.test(data$Meanscore, data$Column8, list(data$Column6 + data$Column7), method = "pearson")

total score and mean score are a linearly dependent, one is 5 times larger than the other. you can scale a vector of numbers and aside from issues related to numeric precision when computing, the correlation between a rescaled vector and some other, should be invarient to the rescaling.

therefore you don't seem to gain anything by calculating a mean.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.