I need to express my linear regression model as an equation so that I can calculate the predictions separately (ie, outside SAS). Ditto for my logistic regression model. Could you confirm whether I'm doing this correctly?
---------------------------------------------------------------------------------
LINEAR regression parameter estimates (using proc genmod)
I've expressed the equation as: prediction = 3.9273 + 0.0015*var1
---------------------------------------------------------------------------------
LOGISTIC regression parameter estimates (using proc logistic, binary, solving for "1")
I've expressed the equation as: probability = exp(-2.8240 + 1.2638*var2) / (1 + exp(-2.8240 + 1.2638*var2))
---------------------------------------------------------------------------------
Yes, no, maybe so??? I need to confirm because when I do this, the answers do not match what I get when scoring in SAS directly. Thank you!
Here's a good thread on this topic.
It has a worked example, the Neuralgia dataset is in SAS documentation if you want to test the code.
Also, look at the CODE statement in those procs if you're in SAS/STAT 13+
This will generate sas data step code that will score your data.
Or you can use PROC SCORE or the SCORE statement within those procs.
See this note.
Not finding the answer yet. Sorry for being a numbskull. I'll try to be more specific.
PART 1: My linear regression code:
proc genmod data = mydataset; model amount = var1 /
link = log dist = gamma type3; output
out = myoutput p = pred; run;
The resulting parameter estimates:
This is a gamma distribution with a log link, so I guess that complicates matters. How should I translate this into an actual mathematical equation?
PART 2: My logistic regression code:
proc logistic data = my_training_dataset outmodel = my_model_info; model responded (event = '1') = var2 /
selection = stepwise lackfit rsq; run; proc logistic inmodel = my_model_info; score data = my_dataset_to_score out = my_scored_dataset; run;
The resulting parameter estimates:
How should I translate this into an actual mathematical equation?
Use the CODE statement in either proc and examine the output.
The initial thread I linked too walked through the solution for LOGISTIC regression in detail so I'm not sure what I could add besides replicating it specifically for your exact values.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.