## Change in parameter estimates in logistic regression

Solved
Occasional Contributor
Posts: 10

# Change in parameter estimates in logistic regression

Hello,

I need some help with this problem i am trying to solve. I am running a logistic regresssion model. After running the full model, i removed one variable from the full model. I want to see how removing that one variable affected the betas (parameter estimates) of the other variables in the model.

I will be very grateful if i can get an answer to this.

Thanks

Accepted Solutions
Solution
‎03-05-2016 11:21 PM
Occasional Contributor
Posts: 10

## Re: Change in parameter estimates in logistic regression

I modified the solution you gave and it worked perfectly well. Thank you so much for your input Reeza.

Below is the complete code for anyone with similar problem:

``````/*1*/
ods table parameterestimates=model1;
proc logistic data=temp;
class sex race hospital snf;
run;

ods table parameterestimates=model2;
proc logistic data=temp;
class sex race hospital;
run;

proc sort data=model1;
by variable;

proc sort data=model2;
by variable;
run;

data comparison;
/*2*/
merge model1 (Rename=estimate=estimate1)
model2 (rename=estimate=estimate2);
by variable;
/*3*/
diff=((estimate1-estimate2)/estimate2)*100;
run;

proc print data=comparison;
run;``````

All Replies
Super User
Posts: 23,773

## Re: Change in parameter estimates in logistic regression

Sorry, It's unclear what your question is. If you have a question on code, please include your current code.

Occasional Contributor
Posts: 10

## Re: Change in parameter estimates in logistic regression

Assuming that i have a logisic regression model with the full model below:

proc logistic data=temp;
class sex race hospital snf;
run;

and then i reduced model as below (it is without the variable snf)

proc logistic data=temp;
class sex race hospital;
run;

I want to see how removing snf from the full model changed the betas (parameter estimates) for other variables in the reduced model.

Occasional Contributor
Posts: 10

## Re: Change in parameter estimates in logistic regression

In other words, i want to check for potential confounding effect of snf.
Super User
Posts: 23,773

## Re: Change in parameter estimates in logistic regression

1. Capture the parameterEstimates from each table
2. Merge tables together - rename estimate variable - I can't remember what it's called at the moment. If you don't rename the variable will overwrite and you won't get valid values.
3. Calculate the difference
``````/*1*/
ods table parameterestimates=model1;
proc logistic data=temp;
class sex race hospital snf;
run;

ods table parameterestimates=model2;
proc logistic data=temp;
class sex race hospital snf;
run;

data comparison;
/*2*/
merge model1 (Rename=estimate=estimate1)
model2 (rename=estimate=estimate2);
by variable;
/*3*/
diff=estimate1-estimate2;
run;``````
Occasional Contributor
Posts: 10

## Re: Change in parameter estimates in logistic regression

Thank you so much. Let me see if it works
Solution
‎03-05-2016 11:21 PM
Occasional Contributor
Posts: 10

## Re: Change in parameter estimates in logistic regression

I modified the solution you gave and it worked perfectly well. Thank you so much for your input Reeza.

Below is the complete code for anyone with similar problem:

``````/*1*/
ods table parameterestimates=model1;
proc logistic data=temp;
class sex race hospital snf;
run;

ods table parameterestimates=model2;
proc logistic data=temp;
class sex race hospital;
run;

proc sort data=model1;
by variable;

proc sort data=model2;
by variable;
run;

data comparison;
/*2*/
merge model1 (Rename=estimate=estimate1)
model2 (rename=estimate=estimate2);
by variable;
/*3*/
diff=((estimate1-estimate2)/estimate2)*100;
run;

proc print data=comparison;
run;``````
Super User
Posts: 10,787

## Re: Change in parameter estimates in logistic regression

Use backward seletion + include= option.

``````
data class;
set sashelp.class;
if _n_ in (1:9) then y=1;
else y=0;
run;

proc logistic data=class;
class sex;
model y(event='1')= sex age weight height/details selection=backward include=3;
run;``````
🔒 This topic is solved and locked.