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).
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.