Data fitting with uncertainty analysis