Dispersion relation analysis of neutral pion photoproduction and electroproduction at threshold