Update functions.R

retrieve the modification about scaling with nobs(Jun 5)