BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Undertow
Calcite | Level 5

When using proc logistic for a multivariable binary logistic regression, the results of the Wald Chi-Square and corresponding P-value are displayed for each variable entered in the model ("Analysis of Maximum Likelihood Estimates" section).

 

Is it possible to display the Score Chi-Square and corresponding P-value for EACH variable instead ? If so, how ?

Thank you for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
JacobSimonsen
Barite | Level 11

I think it is right that proc logistic does not produce the score test for each variable. It is possible to calculate the scoretest for each variable with PHREG, and since logistic regression and Cox-regression is closely connected, we can transform the data and get the wanted scoretest out of PHREG. Just create one single riskset with the number of successes=number of events and censor the rest. Then order the scoretest in the modelstatement.

 

here and example:

data mydata;
 n=10;
  do a=1 to 5;
    do b=1 to 5;
	  do c=1 to 5;
		  y=rand('binomial',1/(1+exp(5-a-b)),n);
		  output;
	end;
  end;
end;
run;
		

data mydata2;
  set mydata;
  t=1;w=y;output;
  t=2;w=n-y;output; (its not important which values you use on t. just one value for the riskset, and the other should be bigger.;
run;
proc phreg data=mydata2; 
  class a b c/param=glm;
   model t*t(2)=a b c/type3(all) ties=discrete;
   freq w;
run;

View solution in original post

6 REPLIES 6
Ksharp
Super User

I never heard  EACH variable in logistic regression. What it stand for ?

Undertow
Calcite | Level 5

This is not an acronym. I just wanted to underline that I would like to have the result of the test score associated with each variable of the multivariable model, not just the result of the score test for the global null hypothesis (All Beta=0), which is already provided by proc logistic.

Ksharp
Super User

Maybe you can't , I think Likelihood Ratio and Score is only for Global H0 .

Undertow
Calcite | Level 5

Thank you for your response. This may be true. However, I doubt it because when you operate a forward (or stepwise) variable selection using proc logistic, the result of the score test for each candidate variable is provided.

However, in this case, the results of each score test seems to correspond to a comparison of the current model vs. the current model + one variable.

 

To make it clearer, let's take an example:

When i run the following SAS code :

" proc logistic desc; model end4_unexplained = age antiplatelet nihss0h
/ selection=forward slstay=0.10 details; run; "

 

At step 1, the variable "nihss0h" is entered in the model.

A the end of step 1, a list of variables eligible for entry is provided, with a Score Chi-Square and corresponding P-value for each candidate variable (please see the image associated to this message). I believe that the P-value for the variable "age" corresponds to a comparison, using the Score Test, of the model with the variables "age" and "nihss0h", versus the model containing only "nihss0h".

Is this correct ?

 

If so, back to the main question of this topic (displaying the results of a Score test for each variable using proc logistic): do you think that such a test can not apply to this situation, or that it is simply not provided by proc logistic ?

 


1.jpg
JacobSimonsen
Barite | Level 11

I think it is right that proc logistic does not produce the score test for each variable. It is possible to calculate the scoretest for each variable with PHREG, and since logistic regression and Cox-regression is closely connected, we can transform the data and get the wanted scoretest out of PHREG. Just create one single riskset with the number of successes=number of events and censor the rest. Then order the scoretest in the modelstatement.

 

here and example:

data mydata;
 n=10;
  do a=1 to 5;
    do b=1 to 5;
	  do c=1 to 5;
		  y=rand('binomial',1/(1+exp(5-a-b)),n);
		  output;
	end;
  end;
end;
run;
		

data mydata2;
  set mydata;
  t=1;w=y;output;
  t=2;w=n-y;output; (its not important which values you use on t. just one value for the riskset, and the other should be bigger.;
run;
proc phreg data=mydata2; 
  class a b c/param=glm;
   model t*t(2)=a b c/type3(all) ties=discrete;
   freq w;
run;
Undertow
Calcite | Level 5
Thank you so much for this elegant solution !

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
  • 1623 views
  • 0 likes
  • 3 in conversation