Statistical analysis of measurements subject to random errors