0

I was trying to learn how to estimate exchangable correlation matrix. I asked ChatGPT to give me an example so that I can learn the steps and ChatGPT gave me this example

Lines <- "ID    Time   Z
 1     1     -1.5
 1     2     -1.5
 1     3      0.5
 1     4      0.5
 2     1     -0.5
 2     2     -0.5
 2     3      1.5
 2     4      1.5"
DF <- read.table(text = Lines, header = TRUE)

resd <- DF$Z n <- length(resd) sigma <- var(resd) rho <- 1 / (n - 1) * sum(resd[-1] * resd[-n]) / sigma ExCorr <- matrix(rho, 4, 4) diag(ExCorr) <- 1

1 0.325 0.325 0.325
0.325 1 0.325 0.325 0.325 0.325 1 0.325 0.325 0.325 0.325 1

I like to get references for this method of estimating the exchangeable correlation matrix 1 / (n - 1) * sum(resd[-1] * resd[-n]) / sigma, how do I identify the source for this formula ? Thanks.

  • 2
    You already identified the source: ChatGPT. Exchangeability implies all correlation coefficients between distinct variables are the same. This is so evident that you shouldn't feel obliged to cite any sources for support. There is a subtlety: those common correlation coefficients are restricted to the interval $[-1/(n-1), 1]$ for $n$ variables. See https://stats.stackexchange.com/a/72798/919 for an explanation and illustration. The specific formula used by ChatGPT, though, is incorrect. It's actually a formula for the lag-1 autocorrelation coefficient of a time series. – whuber Mar 01 '23 at 21:23
  • @whuber, Thanks, somehow the estimates from this approach lag-1 autocorrelation coefficient appears as the alpha from geeglm , geefit$geese$alpha when I set corstr = "exchangeable". I will go through your references. Thanks – Ahir Bhairav Orai Mar 01 '23 at 22:14

0 Answers0