variable "epsilon" does not exist.

146 views
Skip to first unread message

Xulong Wang

unread,
Oct 12, 2015, 4:06:48 PM10/12/15
to Stan users mailing list
I have a simple testing model that worked well yesterday, but not today....

It complains "variable "epsilon" does not exist.", where "epsilon" should be an internal constant.

The model and R code are included in the attached file.

stan101.R

Bob Carpenter

unread,
Oct 12, 2015, 4:21:12 PM10/12/15
to stan-...@googlegroups.com
That should be epsilon() --- constants are functions in Stan.

Also, we recommend controlling sigma with a prior rather than hard
constraint if you need to bound it away from zero. Did you run
into instability issues without this?

Also, your generated quantities can vectorize as just this:

lpd <- normal_log(y, mu, sigma);

- Bob
> --
> 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.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> <stan101.R>

Xulong Wang

unread,
Oct 12, 2015, 4:31:51 PM10/12/15
to Stan users mailing list
Bob, 

Change to epsilon() does not work neither. Stan can not find epsilon().

real<lower=epsilon()> sigma;

Below is the new error message:

No matches for:

  epsilon()

Function epsilon not found.

Bob Carpenter

unread,
Oct 12, 2015, 4:42:58 PM10/12/15
to stan-...@googlegroups.com
Ah, you're right. We removed epsilon() in favor of
machine_precision().

This is unit scaled --- so it's about 1e-15. It's not
the smallest real value by a long shot.

- Bob

Xulong Wang

unread,
Oct 12, 2015, 5:19:17 PM10/12/15
to Stan users mailing list
Thanks Bob, it fixed. I have no clue why simply put "epsilon" worked yesterday. It might be a later revision that was never executed.
Message has been deleted

Xulong Wang

unread,
Oct 12, 2015, 5:54:27 PM10/12/15
to Stan users mailing list
Bob, for the vectorizing trick, seems it does not work for the ordered logistic model, so that first two inputs in ordered_logistic_log() do not accept vectors.

ordered_logistic_log(int, real, vector)

And in this case, I have to write in a loop. 

Bob Carpenter

unread,
Oct 12, 2015, 6:45:47 PM10/12/15
to stan-...@googlegroups.com
No, the ordered logistic won't take vectors. You
can see the signatures in the manual index.

For the last post, you need to assign to the scalar,
not to the vector. You can just get rid of the vector
altogether (unless you need it for WAIC or some other
calculation downstream).

- Bob

Xulong Wang

unread,
Oct 13, 2015, 9:25:06 AM10/13/15
to Stan users mailing list
Thanks much Bob. As always, you are there to help.
Reply all
Reply to author
Forward
0 new messages