calcInSampleError function

Calculate index errors in sample