Hi,
How can I calculate the probability of a logistic regression model given the values of independent variables not only by hand but also by SAS? Please show me some sample code.
Try @Ksharp's code. Start by omitting data=test to score the original data (the crops dataset).
This is known as scoring a model.
As of SAS 9.4 there's the CODE statement that will generate the code you need to score your data.
See several of the options with example code here:
http://blogs.sas.com/content/iml/2014/02/19/scoring-a-regression-model-in-sas.html
This thread has a fully worked example that's a manual process BEFORE the availability of the CODE statement.
I'd use the CODE option now.
Note that the CODE generation is not implemented for all models. I learned the hard way (not in the doc) that I can't get the code for scoring a model containing a constructed spline effect. I am using version 13.1 but I don't see any mention of the feature being added to more recent versions.
There are about three way to score data: CODE , SCORE, STORE statements. Check documentation example Example 72.16: Scoring Data Sets . The simplest is SCORE proc logistic data=Crops; model Crop=x1-x4 / link=glogit; score data=Test out=Score1; run;
@chowfar Have you looked at any of the indicated references? Which ones were unclear?
Try @Ksharp's code. Start by omitting data=test to score the original data (the crops dataset).
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.