Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

BayesFactor: Scale of Cauchy prior in t tests and ANOVA

Hi, I'd like to apologize in advance, if I missed a note regarding the following behavior in the documentation or if this question has been asked before.

After reading about the ANOVA model implemented in the BayesFactor package (Rouder, Morey, Speckman, & Province, 2012) a while ago I wondered whether the scale for the Cauchy prior is affected by centering the design matrix (I should say that I don't fully understand the process of projecting the matrix into the lower dimensional space and its implications). As discussed in the paper (p. 363), in case of two groups in which groups are coded as 0.5 and -0.5, the projected matrix yields a coding of sqrt(2)/2 and -sqrt(2)/2. As a result, the effect is not coded as a distance of 1 but rather as a distance of sqrt(2). Unless I misunderstand, this implies that the Cauchy prior for fixed effects in the ANOVA needs to be scaled accordingly; otherwise r = 1 would imply a different prior in the case of the t test (where no design matrix is centered) and the ANOVA.

I tried this in the BayesFactor package and it appears that this is indeed the case:

library("BayesFactor")
library("dplyr")

medium_scale <- sqrt(2) / 2
wide_scale <- 1
ultrawide_scale <- sqrt(2)

ttest_medium <- ttestBF(formula = extra ~ group, data = sleep, rscale = medium_scale)
ttest_wide <- ttestBF(formula = extra ~ group, data = sleep, rscale = wide_scale)
ttest_ultrawide <- ttestBF(formula = extra ~ group, data = sleep, rscale = ultrawide_scale)

# Different results despite same r
ttest_medium %>%
  as.vector ==
  anovaBF(formula = extra ~ group, data = sleep, rscaleFixed = medium_scale) %>%
  as.vector

ttest_wide %>%
  as.vector ==
  anovaBF(formula = extra ~ group, data = sleep, rscaleFixed = wide_scale) %>%
  as.vector

ttest_ultrawide %>%
  as.vector ==
anovaBF(formula = extra ~ group, data = sleep, rscaleFixed = ultrawide_scale) %>%
  as.vector


# Same results when r is scaled to fit projected design matrix
distance <- BayesFactor:::fixedFromRandomProjection(nlevRandom = 2) %>%
  as.vector %>%
  diff


ttest_medium %>%
  as.vector ==
  anovaBF(formula = extra ~ group, data = sleep, rscaleFixed = medium_scale / distance) %>%
  as.vector

ttest_wide %>%
  as.vector ==
  anovaBF(formula = extra ~ group, data = sleep, rscaleFixed = wide_scale / distance) %>%
  as.vector

ttest_ultrawide %>%
  as.vector ==
  anovaBF(formula = extra ~ group, data = sleep, rscaleFixed = ultrawide_scale / distance) %>%
  as.vector

I find this quite confusing, as I was under the impression that the scale of the (multivariate) Cauchy in the ANOVA case was similarly placed on the scale of standardized mean differences (d) for each effect. However, from toying around with this example I get the impression that the prior is placed on scaled d units. Is this correct? Does the centering of the matrix cause similar changes to the scale of the prior for each mean difference within a factor? How do I correct for them, if I want to use a consistent prior across analyses?

Thanks in advance,
Frederik

Comments

  • For the record, the answer by Richard is here:

    Richard: "if X is the t-test prior scale, then X/sqrt(2) is the ANOVA scale, and X/2 is the corresponding regression scale."

    You: "Thanks for clarifying. So this is not directly related to the rescaled distances between factor levels in the centered design matrix? I think I need to play around with this some more."

    Richard: "Yes, it is. The ANOVA model uses orthonormal contrasts, while the t test didn't (e.g., -.5, .5 does not have length 1, but (-sqrt(2)/2, sqrt(2)/2) does)"

    You: "Thanks again, I think I understand now. If I want to use a (multivariate) Cauchy(r = x)-prior I need to specify rscaleFixed = x/sqrt(2) or rscaleCont = x/2. I think, a note to this effect in the documentation would be helpful. This seems unobvious to me. (cc @EJWagenmakers)"
    :-)

  • edited January 2018

    Thanks, you beat me to it. :smile:

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games