Plotting leverage in a logistic model when event variable has more than 2 values

Reply
New Contributor
Posts: 2

Plotting leverage in a logistic model when event variable has more than 2 values

I am trying to create a graph with the leverage plotted against the predicted values of a logistic model in the proc logisitic step. However, my event has three values (0,1,2) where 0 and 2 are the events I want to predict in two separate models. I use the code in the data statement that says plots(only label maxpoints=none)=leverage  ... to plot this leverage graph. Now this statement works when my dependent variable is either 0, 1 but when my dependent variable is 0,1,2 it does not plot the leverage for me, but there are no error statements in the log. Does anyone know the code to plot leverage in a logit model with more than 2 values for the dependent variable and/or what I am doing wrong? PS when the event = 1 is the reference in the class statement.

Respected Advisor
Posts: 2,655

Re: Plotting leverage in a logistic model when event variable has more than 2 values

Ar you fitting a generalized logit to all three values, or is your intent to fit entirely separate models to outcomes (0, 1) and (1, 2)?  If it is the latter, you might consider using a WHERE statement to limit the responses to the cases of interest.  This should enable the leverage plots.

Steve Denham

New Contributor
Posts: 2

Re: Plotting leverage in a logistic model when event variable has more than 2 values

Posted in reply to SteveDenham

Hello and thank you so much for your response!

It is a generalized logit model to fit to the outcomes 0 and 2 and 1 is in the base. Below is an example of the code I am using in order  to provide you a clearer picture. Again, I am trying to plot leverage against the predicted values for a multinomial logistic model. Thank you!

%let coeff_10 = variable_list;

*Sort panel data.;

proc sort data=dataset1; by event &coeff_10; run;

* Summarize data.;

proc summary data=dataset1; by event &coeff_10;

     output out = dataset2;

run;

* Run multinomial logistical regression, generate coefficients and plot leverage.;

ods graphics on;

ods pdf;

proc logistic data = dataset2  plots =(leverage (MAXPOINTS = None))

     outest=datasetcoef;

     weight _freq_;

     class event(REF='1')/ PARAM=ref;

     MODEL event = &coeff_10/ link = glogit rsq scale=none aggregate noint;

run; quit;

ods graphics off;

ods pdf close;

Super User
Posts: 19,861

Re: Plotting leverage in a logistic model when event variable has more than 2 values

I thought for logistic regression to set the level of the dependent variable it was along the lines of:

model event(event='1') = &coeff_10/....

Rather than the ref level?

If it works though, great Smiley Happy

Ask a Question
Discussion stats
  • 3 replies
  • 184 views
  • 0 likes
  • 3 in conversation