BookmarkSubscribeRSS Feed
jzhang332002
Fluorite | Level 6

I want to do a logistic regression y (0 or 1) over a list of variables x1, x2, x3, x4. Now I want to fix x1's coefficient to be 2.5 and regress against x2-x4. How can I do it?

proc genmod data = mmm descending;

model y = x1 x2 x3 x4 /d=b;

run;

Now I want to fix x1's coefficient to be 2.5 such as:

proc genmod data = mmm descending;

model y = x1(coefficient to be fixed as 2.5) x2 x3 x4 /d=b;

run;

Is that doable? Thanks.

Jian

6 REPLIES 6
stat_sas
Ammonite | Level 13

Please check estimation method for proc genmod.

Community_Help
SAS Employee

Hi there - I moved your post from the general support community space to the SAS Statistical procedures community so users can see your question there. Thanks

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Use the offset option. This forces the coefficient to be 1. So, you first create a variable that is 2.5*x1, and use this.

data mmm; set mmm;

x1_25 = x1*2.5;

proc genmod data=mmm descending;

model y = x2 x3 x4 x5 / offset=x1_25 dist=b;

run;

SteveDenham
Jade | Level 19

Oh, that is sweet.  I would have had some sort of data step where I subtracted off some horrible looking backtransformed from the logit value from the dependent.

Steve Denham

Rick_SAS
SAS Super FREQ

I agree. The drawback of the OFFSET= hack is that it only permits one variable, so isn't as versatile as the RESTRICT statement in PROC REG. Regardless. it's sooo clever!

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

If you want b1=2.5 and b2=5.0, one could do:

data mmm; set mmm;

offset = 2.5*x1 + 5*x2;

run;

proc genmod data=mmm descending;

model y =  x3 x4 x5 / offset=offset dist=b;

run;

And so on...

sas-innovate-2024.png

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.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 6 replies
  • 3349 views
  • 7 likes
  • 6 in conversation