Contributor
Posts: 30

# Force a variable's coefficient during logistic regression ...

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

Posts: 1,258

## Re: Force a variable's coefficient during logistic regression ...

Posted in reply to jzhang332002

Please check estimation method for proc genmod.

SAS Employee
Posts: 232

## Re: Force a variable's coefficient during logistic regression ...

Posted in reply to jzhang332002

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

Valued Guide
Posts: 684

## Re: Force a variable's coefficient during logistic regression ...

Posted in reply to Community_Help

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;

Posts: 2,655

## Re: Force a variable's coefficient during logistic regression ...

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

SAS Super FREQ
Posts: 3,833

## Re: Force a variable's coefficient during logistic regression ...

Posted in reply to SteveDenham

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!

Valued Guide
Posts: 684

## Re: Force a variable's coefficient during logistic regression ...

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...

Discussion stats
• 6 replies
• 592 views
• 3 likes
• 6 in conversation