A general method for parameter estimation of averaging models