Programming the statistical procedures from SAS

In proc logistic, how to display the results of the score test for EACH variable ?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

In proc logistic, how to display the results of the score test for EACH variable ?

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.


Accepted Solutions
Solution
‎10-31-2016 03:34 PM
Super Contributor
Posts: 271

Re: In proc logistic, how to display the results of the score test for EACH variable ?

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


All Replies
Grand Advisor
Posts: 9,452

Re: In proc logistic, how to display the results of the score test for EACH variable ?

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

Occasional Contributor
Posts: 6

Re: In proc logistic, how to display the results of the score test for EACH variable ?

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.

Grand Advisor
Posts: 9,452

Re: In proc logistic, how to display the results of the score test for EACH variable ?

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

Occasional Contributor
Posts: 6

Re: In proc logistic, how to display the results of the score test for EACH variable ?

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 ?

 

Attachment
Solution
‎10-31-2016 03:34 PM
Super Contributor
Posts: 271

Re: In proc logistic, how to display the results of the score test for EACH variable ?

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;
Occasional Contributor
Posts: 6

Re: In proc logistic, how to display the results of the score test for EACH variable ?

Thank you so much for this elegant solution !
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 222 views
  • 0 likes
  • 3 in conversation