1. A method of measuring overlay error on a substrate, the substrate comprising sets of superimposed patterns, the sets of superimposed patterns comprising a top pattern and a bottom pattern, wherein the top and bottom patterns are periodic, and the sets of superimposed patterns having a different bias between the top and bottom patterns, such that a total shift between respective ones of the top and bottom patterns equals a sum of the overlay error and the bias, the method comprising: detecting a diffraction pattern for each of the plurality of biases, the diffraction pattern comprising a first or higher order; determining an asymmetry corresponding to each of the sets of superimposed patterns from the first or higher order; and calculating the overlay error based on the set of asymmetries for the plurality of biases, wherein the calculation comprises modeling the asymmetry, for each of the sets of superimposed patterns, as a function of the total shift as a weighted sum of at least two different oscillating base functions, the base functions having an asymmetry with respect to the total shift between the top and bottom patterns and having a periodicity equal to the pitch of the periodic patterns.