In statistics, the residence time is the average amount of time it takes for a random process to reach a certain boundary value, usually a boundary far from the mean.
Definition
Suppose y(t) is a real, scalar stochastic process with initial value y(t_{0}) = y_{0}, mean y_{avg} and two critical values {y_{avg} − y_{min}, y_{avg} + y_{max}}, where y_{min} > 0 and y_{max} > 0. Define the first passage time of y(t) from within the interval (−y_{min}, y_{max}) as
where "inf" is the infimum. This is the smallest time after the initial time t_{0} that y(t) is equal to one of the critical values forming the boundary of the interval, assuming y_{0} is within the interval.
Because y(t) proceeds randomly from its initial value to the boundary, τ(y_{0}) is itself a random variable. The mean of τ(y_{0}) is the residence time,^{[1]}^{[2]}
For a Gaussian process and a boundary far from the mean, the residence time equals the inverse of the frequency of exceedance of the smaller critical value,^{[2]}
where the frequency of exceedance N is

(1)
σ_{y}^{2} is the variance of the Gaussian distribution,
and Φ_{y}(f) is the power spectral density of the Gaussian distribution over a frequency f.
Generalization to multiple dimensions
Suppose that instead of being scalar, y(t) has dimension p, or y(t) ∈ ℝ^{p}. Define a domain Ψ ⊂ ℝ^{p} that contains y_{avg} and has a smooth boundary ∂Ψ. In this case, define the first passage time of y(t) from within the domain Ψ as
In this case, this infimum is the smallest time at which y(t) is on the boundary of Ψ rather than being equal to one of two discrete values, assuming y_{0} is within Ψ. The mean of this time is the residence time,^{[3]}^{[4]}
Logarithmic residence time
The logarithmic residence time is a dimensionless variation of the residence time. It is proportional to the natural log of a normalized residence time. Noting the exponential in Equation (1), the logarithmic residence time of a Gaussian process is defined as^{[5]}^{[6]}
This is closely related to another dimensionless descriptor of this system, the number of standard deviations between the boundary and the mean, min(y_{min}, y_{max})/σ_{y}.
In general, the normalization factor N_{0} can be difficult or impossible to compute, so the dimensionless quantities can be more useful in applications.
See also
 Cumulative frequency analysis
 Extreme value theory
 Firsthittingtime model
 Frequency of exceedance
 Mean time between failures
Notes
 ^ Meerkov 1987, pp. 1734–1735.
 ^ ^{a} ^{b} Richardson 2014, p. 2027.
 ^ Meerkov 1986, p. 494.
 ^ Meerkov 1987, p. 1734.
 ^ Richardson 2014, p. 2028.
 ^ Meerkov 1986, p. 495, an alternate approach to defining the logarithmic residence time and computing N_{0}
References
 Meerkov, S. M.; Runolfsson, T. (1986). Aiming Control. Proceedings of 25th Conference on Decision and Control. Athens: IEEE. pp. 494–498.CS1 maint: ref=harv (link)
 Meerkov, S. M.; Runolfsson, T. (1987). Output Aiming Control. Proceedings of 26th Conference on Decision and Control. Los Angeles: IEEE. pp. 1734–1739.CS1 maint: ref=harv (link)
 Richardson, Johnhenri R.; Atkins, Ella M.; Kabamba, Pierre T.; Girard, Anouck R. (2014). "Safety Margins for Flight Through Stochastic Gusts". Journal of Guidance, Control, and Dynamics. AIAA. 37 (6): 2026–2030. doi:10.2514/1.G000299. hdl:2027.42/140648.CS1 maint: ref=harv (link)