# Simple generic skewness transform

**URL:** <https://discourse.mc-stan.org/t/simple-generic-skewness-transform/9993>\
**Category:** Modeling\
**Tags:** specification\
**Created:** [July 31, 2019, 10:36am UTC](https://discourse.mc-stan.org/t/simple-generic-skewness-transform/9993 "2019-07-31T10:36:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpapp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/tpapp/32/1240_2.png) [@tpapp](https://discourse.mc-stan.org/u/tpapp)\
**Post date:** [July 31, 2019, 10:36am UTC](https://discourse.mc-stan.org/t/simple-generic-skewness-transform/9993/1 "2019-07-31T10:36:39Z")

</div>

I would like to add skewness to an ad-hoc distribution (defined essentially by an `_lp` user-defined function).

Is there a simple / “canonical” / generally used transformation

f(y; \lambda) = x

which would make y \in \mathbb{R} “more skewed” than x \in \mathbb{R} in some direction depending on its sign? With a nice clean log derivative (Jacobian) so it is easy to program in Stan (hey, I can dream ;P).

It does not need to be mean-preserving, ie E[x] \ne E[y] is fine, the distribution already has something that controls the mean that will just adjust accordingly in the posterior.

---

<div class="post-metadata">

**Author:** ![tpapp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/tpapp/32/1240_2.png) [@tpapp](https://discourse.mc-stan.org/u/tpapp)\
**Post date:** [July 31, 2019, 10:49am UTC](https://discourse.mc-stan.org/t/simple-generic-skewness-transform/9993/2 "2019-07-31T10:49:43Z")

</div>

I am thinking about

y = f(x; m, \lambda, \kappa) = m + (x - m)\cdot\lambda \cdot\text{tanh}(\kappa(x - m))

which would shift things around m. But I imagine that \kappa and \lambda will be heavily correlated in the posterior in nonlinear way, so perhaps fix or drop one of them.

---

<div class="post-metadata">

**Author:** ![bbbales2](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bbbales2/32/77_2.png) [@bbbales2](https://discourse.mc-stan.org/u/bbbales2)\
**Post date:** [August 1, 2019, 5:33pm UTC](https://discourse.mc-stan.org/t/simple-generic-skewness-transform/9993/3 "2019-08-01T17:33:17Z")

</div>

I don’t have experience with this, but if you’re emulating a sign function with that tanh, then I’d imagine you’d probably just fix \kappa going in.

Or like, if it was a skewed normal distribution you were working with, you could scale it with the standard deviation (cause you probably want this switch to happen at a smaller scale than the standard deviation). I dunno though. Like just make \kappa = 10 \sigma?
