transforms...

33 views
Skip to first unread message

Daniel Lee

unread,
May 13, 2015, 9:21:01 PM5/13/15
to stan...@googlegroups.com
I'm starting to walk through the transforms...

what's a reasonable range for the underlying unconstrained variable? I'm looking at the corr_constrain and we've only got from -20 to 20 before the jacobian adjustment of the transform goes to -inf.

I have a testing framework in place, so I can start with something narrow for now.



Daniel






Bob Carpenter

unread,
May 14, 2015, 12:12:54 PM5/14/15
to stan...@googlegroups.com
That's a good question. The correlation transform is just
a scaled and shifted inverse logit

2 * inv_logit(x) - 1

We could scale x if we think 20's not going to be enough.
But I don't think anyone's going to be initializating
at (-20,20) or beyond.

The transform does bound how close rho will be able to
get to -1 or 1. But inv_logit(20) is pretty close to 1,
so it's probably not an issue if people stay away from
super high or low correlations (which are usually problematic
for other reasons).

I think there's a whole lot of research that could be done
on which transforms are more efficient. For instance, they could
be largely linear within their main range and then highly curved
at the edges. We could also do that with just the log transform
for the lower-bound or upper-bound constraints. For example,

(0,inf) -> (-inf, inf)

by taking this piece to be linear

(0.01,inf) -> (0.01,inf)

and then using a non-linear transform here that's
smooth at the boundary

(0, 0.01) -> (-inf, 0.01)

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

Michael Betancourt

unread,
May 14, 2015, 12:44:31 PM5/14/15
to stan...@googlegroups.com
Piecewise is always dangerous. I think the real issue
is that the argument to the logistic is unscaled. If you
really do have large arguments then you’d want to
do something like inv_logit(alpha * x) such that
alpha * x ~ O(1). This carries over to other transforms,
and theoretically we could have tunable transforms.
But the better answer is to invoke the Folk Theorem
and tell people to rescale their data and parameters
to O(1) as this alleviates all the other numerical
problems, too.

Ben Goodrich

unread,
May 14, 2015, 12:47:45 PM5/14/15
to stan...@googlegroups.com, ca...@alias-i.com
On Thursday, May 14, 2015 at 12:12:54 PM UTC-4, Bob Carpenter wrote:
That's a good question.  The correlation transform is just
a scaled and shifted inverse logit

  2 * inv_logit(x) - 1

src/stan/math/prim/scal/fun/corr_constrain.hpp does tanh(x), which is thought to be linearish over much of its range

http://en.wikipedia.org/wiki/Fisher_transformation

Ben

Bob Carpenter

unread,
May 14, 2015, 2:15:55 PM5/14/15
to stan...@googlegroups.com
Oh --- I didn't realize it wasn't using lower_upper,
which I believe is a scaled inverse logit. Should we
scale tanh instead?

Isn't it the domain of tanh, not the range that matters? It looks
like tanh is only roughly linear on (-0.5, 0.5) of its (-inf, inf)
domain.

- Bob
Reply all
Reply to author
Forward
0 new messages