Hello,

I am trying to develop a factor model that generates a nonnegative parameter x in (0, inf) then map that parameter into a probability p in (0,1).

When x is close to zero, I want p to also be close to zero.

As x gets larger, I want p to approach 1.

My guess is that logit might not be the right choice for this. Initially I thought of using

p = inv_logit(x - 6.0)

but I’m worried that might not be stable.

Are there any recommendations for a link function in this case?

I came up with this function that I think would work.

p = 1 - exp(-(x^2) / 2)

x = sqrt(-2 * log(1-p))

I think this would work, but I wanted to ask if there are any established link functions for this kind of model

Thanks

Why not just log the values and use `inv_logit`

? Since x > 0 then that should work.

1 Like

As an alternative, you can just directly parameterize the log probability this way.

```
real<lower=0> neg_log_p;
real p = exp(-neg_log_p);
```

It’s easier to do it the other way around, as I did in my ISBA poster for PCR sensitivity over time:

```
real<upper=0> log_p;
real p = exp(log_p)
```

If you set up a regression on `log_p`

on time, you can constrain it to work on the log probabilities,

```
vector<lower=0>[N] time;
real<upper=0> alpha;
real<upper=0> beta;
for (n in 1:N) {
real p_n = exp(alpha + beta * time); // p_n in (0, 1)
...
}
```

That’s what I used for my ISBA poster on PCR sensitivity tests over time. The `beta`

parameter corresponds to a clearance parameter in a one-compartment ODE model (i.e., it’s exponential decay in time).

1 Like