added code for model selection based on prediction error