Shock to a probability / approximation

Hi! I am looking into an exogenous shock to the probability. I would like to ask if you are aware of a reliable implementation in dynare s.t. the bounds of zero and one are respected to some reliable approximation? I expect that in my case a calibrated volatility of the shock will ensure zero is sometimes hit in the stochastic simulation.

One way around this I thought is to introduce an auxiliary variable x s.t. it is following exogenous AR process, for example, whereas probability y is a logistic function of x. I expect that someone came across this. Is it reliable with a 3 order approximation?

vt = exp(vtwist)/(1+exp(vtwist));
vtwist = (1-RHOV) * VTWISTSS + RHOV * vtwist(-1) + SIGMAVT * e;

Alternatively I could use error function using erf()

As you found out yourself, there is no way to restrict a polynomial to be bounded. As long as you work with perturbation techniques, there is always some probability of simulations violating any bound.

Thank you for the answer. Yes I am aware that it is not probable to bound it. I am just curious if some approximations are better than others. Possibly previous efforts have some guidance on this:)

My own take is that using the function erf(x)/2 +0.5 as a transformation has smaller approximation errors (3rd order) close to zero as opposed to a logistic function. If the upper bound is not an issue, meaning that it will not be reached or is not expected to be reached, then restricting the function’s domain further helps a lot to avoid big approximation errors.

myf6=(erf(x) +1) * UB/2;

That is hard to tell a priori. You will be approximating the nonlinear function with its first three derivatives or so. They may of course differ.