Does anyone know how to calculate the probability based on NLMIXED logit model by plugging in the coefficients or setting it as an average of the whole sample?
The way the predicted probability is computed is right there in your NLMIXED code. Plug in the values of your predictors and use the estimated parameter estimates to compute your xb variable, and then transform it as in the next statement to obtain your prob variable which is the predicted probability. But I should note that this is just a simple logistic model and there is no reason to go to the trouble of using NLMIXED ... the model is easily fit in PROC LOGISTIC. The OUTPUT statement does the same as the PREDICT statement.
proc logistic;
model metab3=time sex age;
output out=preds p=pred;
run;
You mentioned wanting to compare high and low risk groups, but I don't see anything like a group variable in your model. If you add a group variable in the model, then you can use the LSMEANS statement in PROC LOGISTIC to display the probabilities for the two groups and get a test comparing them by adding to the above statements as follows:
proc logistic;
class group / param=glm;
model metab3=group time sex age;
output out=preds p=pred;
lsmeans group / ilink diff;
run;
seems to me that you might need an ESTIMATE statement. Can you provide more information on your PROC NLMIXED program and what you are trying to estimate?
The way the predicted probability is computed is right there in your NLMIXED code. Plug in the values of your predictors and use the estimated parameter estimates to compute your xb variable, and then transform it as in the next statement to obtain your prob variable which is the predicted probability. But I should note that this is just a simple logistic model and there is no reason to go to the trouble of using NLMIXED ... the model is easily fit in PROC LOGISTIC. The OUTPUT statement does the same as the PREDICT statement.
proc logistic;
model metab3=time sex age;
output out=preds p=pred;
run;
You mentioned wanting to compare high and low risk groups, but I don't see anything like a group variable in your model. If you add a group variable in the model, then you can use the LSMEANS statement in PROC LOGISTIC to display the probabilities for the two groups and get a test comparing them by adding to the above statements as follows:
proc logistic;
class group / param=glm;
model metab3=group time sex age;
output out=preds p=pred;
lsmeans group / ilink diff;
run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.