Predict GLM Matlab vs R


I am using glmval (in Matlab) and predict (in R) functions to predict values for a glm model. While I get the same model coefficients in both R and Matlab. I expect both the functions to give me the same predicted values. But this is not the case. Can somebody please explain why ?


Hard to know for sure without seeing your data and the code you ran, but it might be related to the type of model predictions you requested from each function. For example, if you ran a logistic regression using glm in R, the predict function returns predictions on the log-odds scale by default. If you want predictions on the probability scale (i.e., the probability of the outcome, given the predictors), then the code would be predict(model_object, type="response"). See ?predict.glm for details. I haven't used Matlab, but perhaps it uses different defaults.