truncated normal distribution in rstan

77 views
Skip to first unread message

Ru Wang

unread,
Apr 5, 2017, 11:39:26 PM4/5/17
to Stan users mailing list
In my model, one prior is truncated  N(0,100), the parameter should be greater than 0, so the prior in the model block should be 
beta~normal(0,100)T[0,].
Can anyone tell me if this is right. Any help is appreciated. 

Daniel Lee

unread,
Apr 6, 2017, 12:11:15 AM4/6/17
to stan-users mailing list
That's incorrect.

In the parameter's block, declare beta as:
  real<lower = 0> beta;

In the model block, you can now use:
  beta ~ normal(0, 100);

If you really wanted to, you could use:
  beta ~ normal(0, 100) T[0, ];
but that's going to compute the normalizing constant, which isn't needed.



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.

Ru Wang

unread,
Apr 6, 2017, 8:45:48 AM4/6/17
to stan-...@googlegroups.com
Thank u so much, Daniel, I really appreciate your help. 
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/Hii0fpKEFsQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages