Tutorials › Generalized Linear Models › Domain Checks for Links and Inverse Links

Initialization and Numerical Stability · Tutorial 225 of 981

Domain Checks for Links and Inverse Links

Distinguish each link’s valid predictor and mean domains, then use explicit checks to keep trial GLM evaluations inside them.

Intermediate 10 min read

What You'll Learn

  • Identify the valid mean and predictor domains for four common links.
  • Distinguish an inverse formula’s algebraic domain from the range that makes it a true inverse link.
  • Check candidate predictors and inverse-link means before evaluating them.
  • Derive a safe step-size bound for reciprocal and square-root links.
  • Separate mathematical validity from floating-point representability.

Why Link Domains Need Explicit Checks

A GLM fitting algorithm proposes values of the linear predictor \(\eta\), then uses an inverse link to obtain a mean \(\mu\). These operations are valid only on specific domains. A formula may fail outright, such as taking a logarithm of a nonpositive number, or it may return a value that is numerically computable but does not correspond to the intended link. Checking the domain before evaluating the function helps distinguish these cases and prevents an invalid trial from disrupting a fit.

The key distinction is between the domain of the link, which takes a mean to a predictor, and the domain of the inverse link, which takes a predictor to a mean. A valid predictor must lie in the range of the link. It is not enough that an algebraic expression for the inverse link happens to produce a number.

Definition: A link \(g\) relates a mean \(\mu\) to a linear predictor \(\eta\) by \(\eta=g(\mu)\). The inverse link \(g^{-1}\) maps an admissible predictor back to its mean: \(\mu=g^{-1}(\eta)\). A predictor is admissible when it belongs to the range of \(g\), and the resulting mean must belong to the domain of \(g\).

Domains of Four Links

The following table uses the standard logarithmic, reciprocal, square-root, and probit links. For the reciprocal and square-root links, the usual GLM setting here is a positive mean. The square-root link also has a mathematically defined boundary at zero; fitting algorithms that require differentiability generally work in the interior.

Link \(g(\mu)\)Mean domainPredictor rangeInverse link \(g^{-1}(\eta)\)
\(\log(\mu)\)\(\mu>0\)All real \(\eta\)\(\exp(\eta)\)
\(1/\mu\)\(\mu>0\)\(\eta>0\)\(1/\eta\)
\(\sqrt{\mu}\)\(\mu\geq 0\); interior \(\mu>0\)\(\eta\geq 0\); interior \(\eta>0\)\(\eta^2\), for \(\eta\geq0\)
\(\Phi^{-1}(\mu)\) (probit)\(0<\mu<1\)All real \(\eta\)\(\Phi(\eta)\)

Here \(\Phi\) is the standard normal cumulative distribution function. The probit link is defined only for probabilities strictly between zero and one. Conversely, every finite real predictor maps under \(\Phi\) to a probability strictly between zero and one in exact arithmetic.

The square-root row deserves particular care. Although \(\eta^2\) is algebraically defined for negative \(\eta\), it is not the inverse of \(g(\mu)=\sqrt{\mu}\) there: for \(\eta<0\), \(\sqrt{\eta^2}=|\eta|=-\eta\), not \(\eta\). Thus the valid predictor range is nonnegative, not all real numbers. At the boundary \(\eta=0\), the inverse link returns \(\mu=0\); an algorithm that requires a strictly positive mean or a differentiable link should enforce \(\eta>0\) instead.

Worked Example: Checking a Logarithmic Link

Suppose an observation has predictor \(\eta=-0.4\) under the log link. Determine whether the predictor and resulting mean are valid.

The log link is \(g(\mu)=\log(\mu)\), whose mean domain is \(\mu>0\) and whose predictor range is all real numbers. Therefore \(-0.4\) is an admissible predictor. Its inverse-link mean is

$$ \mu=\exp(-0.4)\approx 0.6703. $$

This is finite and positive, so it is in the link’s mean domain. A common implementation error would be to evaluate \(\log(\eta)=\log(-0.4)\), treating the predictor as an input to the link. That operation is not part of obtaining the mean and is undefined over the reals. The correct direction is \(\eta\mapsto\exp(\eta)\).

Worked Example: Rejecting an Invalid Reciprocal Predictor

For a reciprocal link \(g(\mu)=1/\mu\), consider predictors \(\eta_1=-0.2\) and \(\eta_2=0.5\). Check both before calculating their means.

The predictor range is \(\eta>0\). Thus \(\eta_1=-0.2\) is invalid, even though the algebraic expression \(1/\eta_1=-5\) can be evaluated. That result is not a positive mean and cannot be mapped back to the predictor by the reciprocal link. For \(\eta_2=0.5\), the predictor is admissible and

$$ \mu_2=\frac{1}{0.5}=2, \qquad g(\mu_2)=\frac{1}{2}=0.5. $$

The round trip confirms that the computed mean is positive and corresponds to the stated predictor. A robust check tests \(\eta>0\) before performing the division, then checks that \(1/\eta\) is finite and positive in the numerical representation being used.

Worked Example: Square-Root Link and a Negative Predictor

Suppose \(\eta=-1.2\) is proposed under \(g(\mu)=\sqrt{\mu}\). Squaring gives \(\eta^2=1.44\), but this does not make the predictor valid: the link’s range is \(\eta\geq0\). Indeed,

$$ g(1.44)=\sqrt{1.44}=1.2\ne -1.2. $$

For comparison, if \(\eta=1.2\), then \(\mu=\eta^2=1.44\) and \(g(\mu)=1.2\), so the link and inverse link agree. At \(\eta=0\), the inverse formula gives \(\mu=0\), a valid boundary value for the mathematical square-root link. If an algorithm needs the interior of the positive-mean domain, however, it must require \(\eta>0\), not merely \(\eta\geq0\).

Probit Checks: Exact and Numerical Domains

For a probit link, the exact relationship is \(\eta=\Phi^{-1}(\mu)\) and \(\mu=\Phi(\eta)\). The domain checks therefore run in opposite directions: when taking a probit transform, require \(0<\mu<1\); when evaluating the inverse link, require a finite real \(\eta\). In exact arithmetic, these conditions produce a valid probability.

Floating-point calculations add a separate concern. A numerical CDF routine may round a probability extremely close to zero or one to the endpoint, even when the mathematical value is strictly interior. An implementation should check that the computed mean is finite and strictly between zero and one before passing it to an operation that requires an interior probability. It should not silently treat a rounded endpoint as an exact interior value. Stable evaluation of tail probabilities may require specialized numerical routines; a basic domain check cannot restore information already lost to rounding.

Worked Example: Checking Probit Inputs

Take predictors \(\eta=-2, 0,\) and \(1.5\). The corresponding inverse-link means are approximately

$$ \Phi(-2)\approx0.0228,\qquad \Phi(0)=0.5,\qquad \Phi(1.5)\approx0.9332. $$

All three are strictly between zero and one, so they are mathematically valid probit means. The round trip gives \(\Phi^{-1}(\Phi(\eta))=\eta\) for each finite predictor. By contrast, \(\Phi^{-1}(0)\) and \(\Phi^{-1}(1)\) are not finite real numbers. If a computation supplies either endpoint as a mean to the probit link, it must reject that input or handle it with a method specifically designed for the boundary case; it must not call the ordinary inverse CDF as though the input were interior.

Deriving Safe Checks for Trial Updates

During fitting, a proposed update changes each predictor. Domain validation should apply to the candidate predictors before the inverse link is evaluated. For reciprocal and square-root links, strict positivity of the predictor gives a simple upper bound on a step length.

Theorem: Suppose the current predictors \(\eta_i\) are strictly positive and a trial update has the form \(\eta_i(\alpha)=\eta_i+\alpha d_i\), for observations \(i=1,\ldots,n\), with \(\alpha\geq0\). The trial predictors remain strictly positive if and only if \(\eta_i+\alpha d_i>0\) for every \(i\). In particular, if at least one \(d_i<0\), every step satisfying $$ 0\leq\alpha<\min_{i:d_i<0}\frac{\eta_i}{-d_i} $$ is valid. If all \(d_i\geq0\), every finite \(\alpha\geq0\) preserves positivity.

Proof. For a fixed \(i\), if \(d_i\geq0\), then \(\eta_i+\alpha d_i\geq\eta_i>0\). If \(d_i<0\), rearranging the strict positivity condition gives

$$ \eta_i+\alpha d_i>0 \quad\Longleftrightarrow\quad \alpha<\frac{\eta_i}{-d_i}. $$

All constraints must hold at once. Their intersection is the interval from zero up to, but not including, the smallest of the bounds for indices with \(d_i<0\). If there are no such indices, none of the predictors decreases, so all nonnegative finite step lengths preserve positivity. \(\square\)

This bound applies both to a reciprocal link, whose admissible predictors are positive, and to the interior of the square-root link’s predictor range. For the square-root link’s closed mathematical range, nonnegativity rather than strict positivity is sufficient, but a zero predictor may be unsuitable for a fitting method requiring interior values.

Worked Example: Step Halving for Positive Predictors

Let the current predictors be \((0.8,0.7)\), and let the proposed direction be \((-1,0.2)\). For step length \(\alpha=1\), the candidate is

$$ (0.8,0.7)+1(-1,0.2)=(-0.2,0.9). $$

The first predictor is not positive, so this trial is invalid for both the reciprocal link and the interior of the square-root link. The step bound is \(\alpha<0.8/1=0.8\), since only the first direction component is negative. Halving the step gives \(\alpha=0.5\) and

$$ (0.8,0.7)+0.5(-1,0.2)=(0.3,0.8). $$

Both predictors are now positive. Under the reciprocal link, the resulting means are \((1/0.3,1/0.8)=(10/3,1.25)\). Under the square-root link, they are \((0.3^2,0.8^2)=(0.09,0.64)\). Each is positive, and applying its link returns the corresponding predictor.

For a log link, every finite real predictor is mathematically admissible; for a probit link, every finite real predictor is mathematically admissible as well. These links do not require a positive-predictor step bound. They still require checks for nonfinite predictors and for inverse-link results that cannot be represented safely by the computer. Domain validity in exact arithmetic does not guarantee safe floating-point evaluation.

A Practical Domain-Checking Procedure

1
Check the inputs.
Confirm that candidate predictors are finite. Check that any supplied means satisfy the link’s mean domain before applying the link.
2
Check the predictor range.
Require \(\eta>0\) for a reciprocal link and \(\eta\geq0\) for the square-root link, or \(\eta>0\) when an interior positive mean is required. Log and probit links accept any finite real predictor.
3
Evaluate the inverse link.
Only after the range check, compute the candidate mean. Avoid evaluating a formula outside its intended input domain.
4
Validate the result.
Check that the mean is finite and satisfies its required range: positive for log and reciprocal, nonnegative or positive for square-root, and strictly between zero and one for probit.
5
Reject or shorten invalid trials.
Do not continue with an invalid candidate. For positive-predictor links, enforce the step bound or reduce the step and repeat the checks.

Common Mistake: Checking Only Whether a Formula Returns a Number

A frequent error is to decide that a predictor is valid because the written inverse formula can be evaluated. For example, \(1/(-0.2)=-5\) is a numerical result, and \((-1.2)^2=1.44\) is also a numerical result. Neither establishes a valid predictor: the reciprocal link requires a positive predictor, and the square-root link’s range excludes negative predictors. The correction is to check the range of the link first, then calculate the inverse link, then validate the resulting mean.

A second error is to confuse a mathematical domain check with a floating-point safety check. A finite real predictor is valid for the log and probit links in exact mathematics, but its numerical inverse-link evaluation may still overflow, underflow, or round to an endpoint. Check representability and the computed result as well as the mathematical domain. These checks make a failed trial identifiable and prevent it from being mistaken for an ordinary numerical update.

Key takeaway: Validate predictors against the range of the link, not just the algebraic domain of the inverse formula. Then validate the computed mean against the link’s mean domain and the numerical requirements of the calculation.

Check Your Understanding

For each question, distinguish the mathematical domain condition from any numerical check that may also be needed.

  1. For a reciprocal link, is \(\eta=-0.5\) admissible because \(1/\eta\) is computable? Explain.
  2. For the square-root link, what is the mean at \(\eta=0\), and why might a fitting algorithm still require \(\eta>0\)?
  3. Which inputs are valid for the probit link, and which are valid for its inverse link?
  4. A reciprocal-link fit has predictors \((1.2,0.6)\) and direction \((-0.4,-0.1)\). Find the strict upper bound on a nonnegative step length that preserves positive predictors.
  5. Why is a finite real predictor not, by itself, proof that the computed inverse-link mean is numerically safe?
Clinical Biostats