model with constrained parameters

152 views
Skip to first unread message

Justina

unread,
Jan 9, 2017, 10:24:41 AM1/9/17
to Stan users mailing list
Hi all, I was wondering if there is an option in rstanarm to estimate a model with parameter constraints? 

e.g. y = a + b*x
where b is
vector<lower=0>[K] b;

Thanks

Ben Goodrich

unread,
Jan 9, 2017, 3:47:42 PM1/9/17
to Stan users mailing list

There is no such option in rstanarm because the models are precompiled. You can certainly specify a prior mean and prior standard deviation such that zero is three or four standard deviations below the prior mean, in which case it is very unlikely that much of the posterior mass would be below zero.

Alternatively, I think you can do constraints like that in brms or certainly if you write the Stan program yourself.

Ben

Paul Buerkner

unread,
Jan 10, 2017, 12:25:48 PM1/10/17
to Stan users mailing list
Ben is right, you can do this in brms (see help("set_prior")), but there are not many cases where this is actually useful.

Jonah Gabry

unread,
Jan 10, 2017, 3:09:08 PM1/10/17
to Stan users mailing list
I agree with Paul that this is not often useful. Unless the lower=0 constraint is a logical requirement (e.g. variances must have lower=0) it's usually better to impose soft constraints via a prior that places little weight on negative values (as Ben suggested). That can be done easily using the "prior" argument to any of the modeling functions in rstanarm. If there really is a constraint that is absolutely necessary then, judging from what Paul said, it should be simple to try brms for that. 

Jonah

Justina

unread,
Jan 13, 2017, 6:00:39 AM1/13/17
to Stan users mailing list
Thank you for suggestions, I will have a look!
Reply all
Reply to author
Forward
0 new messages