Data reduction and error analysis for the physical sciences