  The offset of high redshift star-forming galaxies in the [OIII]/H$\beta$
versus [NII]/H$\alpha$ (O3N2) diagram in comparison with the local star-forming
galaxy sequence is now well established. The physical origin of the shift is
the subject of some debate, and has important implications for metallicity
measurements based on strong lines at all redshifts. To investigate the origin
of the O3N2 offset, we use a sample of ~100,000 star-forming galaxies from SDSS
DR12 to probe the empirical correlations between emission line diagnostics and
measurable galaxy physical properties. In particular, we examine how surface
density of star formation, ionization parameter, nitrogen-to-oxygen (N/O)
ratio, and stellar mass drive position in two key diagnostic diagrams: O3N2 and
[OIII]/H$\beta$ versus [SII]/H$\alpha$ (O3S2). We show that, at fixed
[OIII]/H$\beta$, galaxies falling closer to the high-redshift locus in O3N2
have higher star formation density, stellar mass and N/O ratios. We also find a
tight correspondence in the distributions of stellar mass and N/O in the
diagnostic diagrams. This relation, spanning a range of galaxy evolutionary
states, suggests that the N/O-$M_{*}$ relation is more fundamental than the
N/O-metallicity relation. We argue that a tight N/O-$M_{*}$ relation is
well-motivated physically, and that the observed correlation of N/O with O/H in
the local universe is primarily a reflection of the existence of the
mass-metallicity relation. Because the mass-metallicity relation evolves much
more rapidly with redshift than N/O-$M_{*}$, the N/O ratios of high redshift
galaxies are significantly elevated in comparison with local galaxies with the
same gas-phase O/H. The O3N2 shift and elevated N/O ratios observed in high
redshift galaxies therefore come about as a natural consequence of the
N/O-$M_{*}$ relation combined with the evolution of the mass-metallicity
relation.
