We study the fundamental relationship between stable quotient invariants and the B-model for local CP2 in all genera. Our main result is a direct geometric proof of the holomorphic anomaly equation in the precise form predicted by B-model physics. The method yields new holomorphic anomaly equations for an infinite class of twisted theories on projective spaces. An example of such a twisted theory is the formal quintic defined by a hyperplane section of CP4 in all genera via the Euler class of a complex. The formal quintic theory is found to satisfy the holomorphic anomaly equations conjectured for the true quintic theory. Therefore, the formal quintic theory and the true quintic theory should be related by transformations which respect the holomorphic anomaly equations.