first model averaging function