  Galaxy metallicity scaling relations provide a powerful tool for
understanding galaxy evolution, but obtaining unbiased global galaxy gas-phase
oxygen abundances requires proper treatment of the various line-emitting
sources within spectroscopic apertures. We present a model framework that
treats galaxies as ensembles of HII and diffuse ionized gas (DIG) regions of
varying metallicities. These models are based upon empirical relations between
line ratios and electron temperature for HII regions, and DIG strong-line ratio
relations from SDSS-IV MaNGA IFU data. Flux-weighting effects and DIG
contamination can significantly affect properties inferred from global galaxy
spectra, biasing metallicity estimates by more than 0.3 dex in some cases. We
use observationally-motivated inputs to construct a model matched to typical
local star-forming galaxies, and quantify the biases in strong-line ratios,
electron temperatures, and direct-method metallicities as inferred from global
galaxy spectra relative to the median values of the HII region distributions in
each galaxy. We also provide a generalized set of models that can be applied to
individual galaxies or galaxy samples in atypical regions of parameter space.
We use these models to correct for the effects of flux-weighting and DIG
contamination in the local direct-method mass-metallicity and fundamental
metallicity relations, and in the mass-metallicity relation based on
strong-line metallicities. Future photoionization models of galaxy line
emission need to include DIG emission and represent galaxies as ensembles of
emitting regions with varying metallicity, instead of as single HII regions
with effective properties, in order to obtain unbiased estimates of key
underlying physical properties.
