# Trouble with non-central parameterization in meta-analysis

**URL:** <https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067>\
**Category:** Modeling\
**Tags:** meta-analysis, fitting-issues\
**Created:** [January 22, 2018, 10:09am UTC](https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067 "2018-01-22T10:09:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Isaac\_Fradkin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/isaac_fradkin/32/2793_2.png) [@Isaac\_Fradkin](https://discourse.mc-stan.org/u/Isaac_Fradkin)\
**Post date:** [January 22, 2018, 10:09am UTC](https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067/1 "2018-01-22T10:09:18Z")

</div>

Dear All.

I’m trying to build a random effect meta-analytic model using rstan. (I’m actually doing this not for MA, but for data that described ratings given by 20-25 raters on open-ended answers of other participants, and want to account for the fact the the mean rating is not the true state of the original participants, but an estimate).

Here is the model:

data{  
int\<lower=0\> N; //number of data points  
vector[N] y; //effect size  
vector[N] P; //effect size variance  
}

parameters{  
real\<lower=0\> sigmaRes; //true variance  
vector[N] eta;  
}

transformed parameters{  
real mu;  
vector[N] Y;

for (i in 1:N){  
Y[i]=eta[i]\*sigmaRes+mu;

}  
}

model{  
sigmaRes~cauchy(0,2.5);  
y~normal(Y,sqrt§);  
eta~normal(0,1);  
}

I get the following error:  
Rejecting initial value:  
Error evaluating the log probability at the initial value.  
Exception: normal\_lpdf: Location parameter[1] is nan, but must be finite! (in ‘model1e087e7d5467\_fae42cbcc023f3e79b89081a16a7be8f’ at line 26)

Now, when using a central parameterization, this basic model works, but as soon as I start adding random intercepts and slopes (i.e. by making mu -\> mu[i] and specifying it as a linear combination of parameters, as done in a multilevel model) - I get bfmi warnings, and tree\_depth issues. So I try non-central parameterization.

Thanks a lot in advance,  
Isaac

---

<div class="post-metadata">

**Author:** ![sakrejda](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sakrejda/32/845_2.png) [@sakrejda](https://discourse.mc-stan.org/u/sakrejda)\
**Post date:** [January 22, 2018, 12:10pm UTC](https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067/2 "2018-01-22T12:10:46Z")

</div>

`mu` is undefined in the model so `Y` is undefined, which is also a location parameter, so you get the error.

---

<div class="post-metadata">

**Author:** ![Isaac\_Fradkin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/isaac_fradkin/32/2793_2.png) [@Isaac\_Fradkin](https://discourse.mc-stan.org/u/Isaac_Fradkin)\
**Post date:** [January 22, 2018, 12:27pm UTC](https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067/3 "2018-01-22T12:27:04Z")

</div>

Thanks for the response!  
I’ve tried to add a prior for mu:  
mu~normal(50,100); (The scale is 0-100),

but got an error:

Rejecting initial value:  
Error evaluating the log probability at the initial value.  
Exception: normal\_lpdf: Random variable is nan, but must not be nan! (in ‘model1da06055fdf\_6baf8af08d9ec2d712ad106daea3fa24’ at line 25)

Any ideas?

---

<div class="post-metadata">

**Author:** ![sakrejda](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sakrejda/32/845_2.png) [@sakrejda](https://discourse.mc-stan.org/u/sakrejda)\
**Post date:** [January 22, 2018, 4:12pm UTC](https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067/4 "2018-01-22T16:12:38Z")

</div>

The tilde doesn’t assign a value to mu. What is mu supposed to be in this model?

---

<div class="post-metadata">

**Author:** ![Isaac\_Fradkin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/isaac_fradkin/32/2793_2.png) [@Isaac\_Fradkin](https://discourse.mc-stan.org/u/Isaac_Fradkin)\
**Post date:** [January 22, 2018, 9:27pm UTC](https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067/5 "2018-01-22T21:27:20Z")

</div>

Oh. Sorry for not clearing this up. Mu is supposed to be the estimate of the average effect (if this is a meta-analysis). yi is the observed effects, and P is the se’s. Yi are the studies’ true effects, and they are distributed around an average effect mu.

---

<div class="post-metadata">

**Author:** ![sakrejda](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sakrejda/32/845_2.png) [@sakrejda](https://discourse.mc-stan.org/u/sakrejda)\
**Post date:** [January 22, 2018, 11:13pm UTC](https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067/6 "2018-01-22T23:13:26Z")

</div>

Sounds like you should make it a parameter then.

---

<div class="post-metadata">

**Author:** ![Isaac\_Fradkin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/isaac_fradkin/32/2793_2.png) [@Isaac\_Fradkin](https://discourse.mc-stan.org/u/Isaac_Fradkin)\
**Post date:** [January 23, 2018, 8:26am UTC](https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067/7 "2018-01-23T08:26:43Z")

</div>

Oh… interesting. It was a transformed parameter before, because in the full model I’ve added a random effect:  
mu[i]=b0[Subject[i]].  
But at least it works not when making it a parameter (rather than transformed one). So Thanks a lot for this!  
I’m not sure I understand why it works as a parameter but not as a transformed parameter. Also - any way to add a linear model (random effects and potential fixed effects) to mu without making it a transformed parameter?

Thanks a lot!  
Isaac.

---

<div class="post-metadata">

**Author:** ![sakrejda](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sakrejda/32/845_2.png) [@sakrejda](https://discourse.mc-stan.org/u/sakrejda)\
**Post date:** [January 23, 2018, 11:08am UTC](https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067/8 "2018-01-23T11:08:22Z")

</div>

You might want to read again the manual sections that describe the  
different blocks. It confused me for a while too but its one of tree  
things that makes the language more expressive.

---

<div class="post-metadata">

**Author:** ![Bob\_Carpenter](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bob_carpenter/32/9230_2.png) [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Post date:** [February 6, 2018, 2:24am UTC](https://discourse.mc-stan.org/t/trouble-with-non-central-parameterization-in-meta-analysis/3067/9 "2018-02-06T02:24:09Z")

</div>

> [@Isaac\_Fradkin](#):
>
> I’m not sure I understand why it works as a parameter but not as a transformed parameter.

Parameters are provided by initialization and then by the sampling algorithm. Transformed parameters are defined as functions of other parameters (and data).
