scaled_inv_chi_square, sd or variance?

262 views
Skip to first unread message

Stefano

unread,
Dec 1, 2016, 10:58:30 PM12/1/16
to Stan users mailing list
Hello,

I would like a confirmation, on which has to be used

1) standard_deviation ~  scaled_inv_chi_square(... , ...)

OR

2) standard_deviation^2 ~  scaled_inv_chi_square(... , ...)

If I use 2, a Jacobian warning is produced

DIAGNOSTIC(S) FROM PARSER:
Warning (non-fatal):
Left-hand side of sampling statement (~) may contain a non-linear transform of a parameter or local variable.
If so, you need to call increment_log_prob() with the log absolute determinant of the Jacobian of the transform.
Left-hand-side of sampling statement:
    pow_ex_sd[g] ~ scaled_inv_chi_square(...)


Thanks a lot.

Daniel Lee

unread,
Dec 1, 2016, 11:14:58 PM12/1/16
to stan-users mailing list
Hi Stefano,

I don't understand your question. Neither *has* to be used -- you should use what is best for creating a statistical model.

Regarding the Jacobian warning, #2 will generate the warning. That warning SHOULD NOT be ignored in this case.


Daniel



--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

stefano

unread,
Dec 2, 2016, 2:01:34 AM12/2/16
to stan-...@googlegroups.com
Thanks for your answer,

usually the variance (standard deviation ^2) is modeled as random variable with scaled_inv_chi_square. Can you confirm this general knowledge?

If this is true, I would square my standard deviation, (there is no example in the reference guide). If so what Jacobian adjustment should I use?

Thanks.

--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/RgV0uUKrlIk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.

Ben Goodrich

unread,
Dec 2, 2016, 9:41:08 AM12/2/16
to Stan users mailing list
On Friday, December 2, 2016 at 2:01:34 AM UTC-5, Stefano wrote:
usually the variance (standard deviation ^2) is modeled as random variable with scaled_inv_chi_square. Can you confirm this general knowledge?

I think the only way in which the scaled inverse chi-squared distribution is used is with normal mixtures, in which case it pertains to the variance. But then you might as well use the Student t distribution.
 
If this is true, I would square my standard deviation, (there is no example in the reference guide). If so what Jacobian adjustment should I use?

Just make the primitive parameter be a variance rather than a standard deviation and then there is no need for a Jacobian adjustment.

Ben


Aki Vehtari

unread,
Dec 2, 2016, 1:20:29 PM12/2/16
to Stan users mailing list
On Friday, December 2, 2016 at 9:01:34 AM UTC+2, Stefano wrote:
usually the variance (standard deviation ^2) is modeled as random variable with scaled_inv_chi_square. Can you confirm this general knowledge?

For variance parameter in a normal model scaled_inv_chi_square is a conjugate prior, which is useful for Gibbs sampling or partial analytic marginalisation, but HMC/NUTS can handle non-conjugate priors as easily as conugate priors, so there is no need to restrict the prior shape. Instead choose the prior based on what you know.  Nowdays it's rare to see scaled_inv_chi_square prior used in Stan models. See  also the discussion of priors at Stan prior choice wiki https://github.com/stan-dev/stan/wiki/Prior-Choice-Recommendations

Aki

stefano

unread,
Dec 4, 2016, 6:27:15 PM12/4/16
to stan-...@googlegroups.com
Thanks Guys,

I see what you mean.

well in this plot you can see that the standard deviation has beta-like distribution (being values distributed quasi-normally)

Immagine incorporata 1

However if I use beta the model performs and converges poorly, my impression is that the beta is harder to model, because of its wide spectra of shapes it can acquire.

For example the convergence modeling standard deviation as normal is much stable (even though does not interpret the data well).

Now:

1) which density function can I use that would be more contrained, or
2) does it make sense to fix a parameter of the beta, or
3) in what other way can I model the standard deviation/variance?

Thanks.

Stefano Mangiola

Data analyst (MSc, MPhil, PhD candidate)
@ Melbourne University
Hovens lab - Papenfuss lab
Royal Melbourne Hospital - WEHI

--

Andrew Gelman

unread,
Dec 4, 2016, 6:52:38 PM12/4/16
to stan-...@googlegroups.com
I think you mean a gamma-like distribution, not a beta-like.

On Dec 4, 2016, at 6:27 PM, stefano <mangiol...@gmail.com> wrote:

Thanks Guys,

I see what you mean.

well in this plot you can see that the standard deviation has beta-like distribution (being values distributed quasi-normally)

<image.png>


--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.

stefano

unread,
Dec 4, 2016, 6:59:37 PM12/4/16
to stan-...@googlegroups.com
Sorry gamma!

Stefano Mangiola

Data analyst (MSc, MPhil, PhD candidate)
@ Melbourne University
Hovens lab - Papenfuss lab
Royal Melbourne Hospital - WEHI

To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

stefano

unread,
Dec 4, 2016, 7:03:18 PM12/4/16
to stan-...@googlegroups.com
2016-12-05 10:27 GMT+11:00 stefano <mangiol...@gmail.com>:
Thanks Guys,

I see what you mean.

well in this plot you can see that the standard deviation has beta-like distribution (being values distributed quasi-normally)
*Gamma (not beta)

Immagine incorporata 1

However if I use beta the model performs and converges poorly, my impression is that the beta
*Gamma (not beta)
is harder to model, because of its wide spectra of shapes it can acquire.

For example the convergence modeling standard deviation as normal is much stable (even though does not interpret the data well).

Now:

1) which density function can I use that would be more contrained, or
2) does it make sense to fix a parameter of the beta, or
*Gamma (not beta)

Emmanuel Charpentier

unread,
Dec 5, 2016, 6:22:13 AM12/5/16
to Stan users mailing list
Dear Ben,


Le vendredi 2 décembre 2016 15:41:08 UTC+1, Ben Goodrich a écrit :
On Friday, December 2, 2016 at 2:01:34 AM UTC-5, Stefano wrote:
usually the variance (standard deviation ^2) is modeled as random variable with scaled_inv_chi_square. Can you confirm this general knowledge?

I think the only way in which the scaled inverse chi-squared distribution is used is with normal mixtures, in which case it pertains to the variance. But then you might as well use the Student t distribution.
 
<ShamelessPlug> It could be used also when the variance is a parameter of interest rather than a nuisance parameter, such as in this paper (where the problem is treated otherwise)... </ShamelessPlug>

You gave me an interesting idea...

--
Emmanuel Charpentier

Reply all
Reply to author
Forward
0 new messages