fn
log_ndtr
→Tensorlog_ndtr(x: Tensor)Numerically stable logarithm of the standard normal CDF.
Computes without losing precision in the deep
left tail, where the direct composition log(ndtr(x)) underflows.
Essential for log-likelihood evaluation of probit / Tobit / censored
models that need to handle cleanly.
Parameters
xTensorInput tensor; any floating-point dtype.
Returns
Tensor element-wise, same shape and dtype as
x; values lie in .
Notes
The implementation switches strategies on a branch boundary at
x = -1:
For we have so the
direct log(ndtr(x)) is safe. Below the identity
is used,
sidestepping the catastrophic cancellation in
.
Examples
>>> import lucid
>>> from lucid.special import log_ndtr
>>> log_ndtr(lucid.tensor([-10.0, -1.0, 0.0, 1.0]))
Tensor([-52.6651, -1.8410, -0.6931, -0.1727])