# [R-meta] Model with intercept gives 0 heterogeneity but without intercept is ok

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Mon Aug 30 21:42:38 CEST 2021

```>-----Original Message-----
>From: Luke Martinez [mailto:martinezlukerm using gmail.com]
>Sent: Monday, 30 August, 2021 20:46
>To: Viechtbauer, Wolfgang (SP)
>Cc: R meta
>Subject: Re: [R-meta] Model with intercept gives 0 heterogeneity but without
>intercept is ok
>
>Dear Wolfgang,
>
>Thank you.
>
>1- To make sure I understand this correctly, you're saying that because I killed
>the intercept, then the intercept for one or more continuous moderators equals 0
>for all studies, thus, there is no intercept to vary across the levels of study,
>hence no between-study variance component can be estimated (sigma^2.1 == 0),
>correct?

This doesn't sound right. Removing the intercept in this model says that the average effect must be 0 when X = 0. One can still estimates the variance components whether there is an intercept or not. They have different interpretations though, since the variances are estimated as deviations from a line that has an intercept of 0 or not.

>2- Under this circumstance (killing intercept with continuous moderators only),
>the intercepts (or averages) for "study/outcome" combinations can still vary
>across study-outcome combinations, and thus, in isolation from "sigma^2.1",  the
>other "sigma^2.2" can be [correctly] estimated, correct?

Again, both variance components can be estimated. It just happens to be the case that sigma^2.1 is estimated to be essentially 0 in Model1.

>3- I have seen models where the intercept is killed in the fixed part, but present
>in the random part. Based on what you said, in such models at least 1 categorical
>moderator must be present so the between-study variance component can be estimated
>(e.g., below), correct?

Again, all variance components can be estimated whether the fixed part includes an intercept or not.

>data\$gender <- sample(c("M","F"),nrow(data),replace = TRUE)
>
>rma.mv(yi ~ 0 + X + gender, vi, random = ~ 1 | study/outcome)
>
>                     estim    sqrt  nlvls  fixed         factor
>sigma^2.1  0.0000  0.0001     60     no          study  <---   Still "0" ?
>sigma^2.2  0.5932  0.7702    120     no  study/outcome

In this case, the model is identical whether you use '0 + X + gender' or 'X + gender', just the parameterization of the fixed part is different. Please see the link I posted.

>Thank you very much,
>Luke
>
>On Mon, Aug 30, 2021 at 11:26 AM Viechtbauer, Wolfgang (SP)
><wolfgang.viechtbauer using maastrichtuniversity.nl> wrote:
>Dear Luke,
>
>If X is a continuous moderator, removing the intercept forces the line to go
>through the origin. That is very rarely a sensible thing to do. See also:
>
>https://www.metafor-project.org/doku.php/tips:models_with_or_without_intercept
>
>Best,
>Wolfgang
>
>>-----Original Message-----
>>From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On
>>Behalf Of Luke Martinez
>>Sent: Monday, 30 August, 2021 18:02
>>To: R meta
>>Subject: [R-meta] Model with intercept gives 0 heterogeneity but without
>intercept
>>is ok
>>
>>Dear Colleagues.
>>
>>I fitted two exact same models except that for one I included the intercept
>>(Model 1) in the model, for the other, I didn't (Model 2).
>>
>>I wonder why for Model 1 the estimate of between-study heterogeneity is "0"
>>but for Model 2 that estimate is not "0"?
>>
>>Thank you very much,
>>Luke
>>
>>set.seed(132)
>>data <- expand.grid(study = 1:60, outcome = rep(1:2,2))
>>data\$X <- rnorm(nrow(data))
>>e <- rnorm(nrow(data))
>>data\$yi <- .8+.6*data\$X + e
>>data\$vi <- runif(nrow(data))
>>
>>Model1 <- rma.mv(yi ~ 1 + X, vi, random = ~ 1 | study/outcome, data = dat)
>>
>>                       estim    sqrt  nlvls  fixed         factor
>>sigma^2.1  0.0000  0.0001     60     no          study
>>sigma^2.2  0.4707  0.6861    120     no  study/outcome
>>
>>
>>Model2 <- rma.mv(yi ~ 0 + X, vi, random = ~ 1 | study/outcome, data = dat)
>>
>>                    estim    sqrt  nlvls  fixed         factor
>>sigma^2.1  0.5634  0.7506     60     no          study
>>sigma^2.2  0.4878  0.6984    120     no  study/outcome
```