  Near-infrared array detectors, like the \JWST NIRSpec's Teledyne's H2RGs,
often provide reference pixels and a reference output. These are used to remove
correlated noise. Improved Reference Sampling and Subtraction (\IRSSquare,
pronounced "IRS-square") is a statistical technique for using this reference
information optimally in a least squares sense. Compared to "traditional" H2RG
readout, \IRSSquare uses a different clocking pattern to interleave many more
reference pixels into the data than is otherwise possible. Compared to standard
reference correction techniques, \IRSSquare subtracts the reference pixels and
reference output using a statistically optimized set of frequency dependent
weights. The benefits include somewhat lower noise variance and much less
obvious correlated noise. NIRSpec's \IRSSquare images are cosmetically clean,
with less $1/f$ banding than in traditional data from the same system. This
article describes the \IRSSquare clocking pattern and presents the equations
that are needed to use \IRSSquare in systems other than NIRSpec. For NIRSpec,
applying these equations is already an option in the calibration pipeline. As
an aid to instrument builders, we provide our prototype \IRSSquare calibration
software and sample \JWST NIRSpec data. The same techniques are applicable to
other detector systems, including those based on Teledyne's H4RG arrays. The
H4RG's "interleaved reference pixel readout" mode is effectively one \IRSSquare
pattern.
