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

Hello, 

I would like to ask questions related to my project that I am currently doing. 

Have a data which is nonparametric, which fairly recently relaised.. 

So before I notice I need to apply nonparametric method, I did logistic regression (univariate, univariable). 

Then as I said data has characteristics and now studying nonparametric method but there are many things that I am no sure. 

So my questions are:

1. Can I use "proc adaptivereg" when there is one variable and one variate? 

   This is because I have looked at below and kindly explained that the proc adaptivereg is for multivariate..

http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_adaptivereg_...

1-1. when it is multivariate, does that mean I can have only one variable or it doesnt matter in multivariate setting? 

 

2. If question 1 is no, then can you recommend syntax for nonparametric data for simple logistic regression? 

(I used proc logistic before)  

 

It would be great help for me. 

 

Many thanks and best wishes,

 

Danielle. 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Yes, you can use PROC ADAPTIVEREG for univariate analysis. "Multivariate" means "one or more" in this situation. Here is some data and an example:

 

data Cars;
set sashelp.cars;
where Origin in ('Asia', 'USA');
Event = (Origin="USA");   /* equivalent 0/1 binary numerical response */
run;

proc sort data=cars;
by weight;
run;
proc adaptivereg data=cars; model Origin(event="USA") = weight; output out=AdaptiveOut p(ilink); run; proc sgplot data=AdaptiveOut noautolegend; scatter x=weight y=Event / jitter jitterwidth=0.1; series x=weight y=Pred; yaxis min=0 max=1 grid label="Predicted Probability" offsetmax=0.1 offsetmin=0.1; run;

 

As Paige and others have said, you can also use spline effects with PROC LOGISTIC. For a discussion, see the article "Regression with restricted cubic splines in SAS". Here is an example, modified from that article:

 

/* create sample data; sort by independent variable for graphing */
data Cars;
set sashelp.cars;
where Origin in ('Asia', 'USA');
Event = (Origin="USA");   /* equivalent 0/1 binary numerical response */
run;

proc sort data=cars;
   by weight;
run;
 
/* Fit data by using restricted cubic splines.
   The EFFECT statement is supported by many procedures: */
title "Restricted Cubic Spline Regression";
proc logistic data=cars plots=none;
  effect spl = spline(weight / details naturalcubic basis=tpf(noint)                 
                               knotmethod=percentiles(5) );
   model Origin(event="USA") = spl;       /* fit model by using spline effects */
   output out=SplineOut predicted=PredProb;    /* output predicted values for graphing */
quit;
 
proc sgplot data=SplineOut noautolegend;
   scatter x=weight y=Event / jitter jitterwidth=0.1;
   series x=weight y=PredProb;
   yaxis min=0 max=1 grid label="Predicted Probability" offsetmax=0.1 offsetmin=0.1;
run;

View solution in original post

9 REPLIES 9
PaigeMiller
Diamond | Level 26

Let's start at the beginning. Why do you think you need a non-parametric analysis here?

--
Paige Miller
Daniellekeem
Fluorite | Level 6

Predicted probability and result of logistic regression say different things. For example predicted probability decreases from age 15 to 31 then increase from 32 to 49 whilst logistic regression says age 1 year older probability will be decreasing. So it seems non-linear relations but regressions says linear which I am not sure but just reckon.

 

PaigeMiller
Diamond | Level 26

You can fit a polynomial regression in PROC LOGISTIC.

 

You can use the EFFECT statement in PROC LOGISTIC to fit a spline through the x-variable that might be a good predictor or the probability.

--
Paige Miller
Daniellekeem
Fluorite | Level 6

Thank you so much!!

Reeza
Super User
Non-parametric refers to methods not data. Data cannot be non-parametric. A common misconception is that non normal data requires non -parametric by default. This is not always true.
Daniellekeem
Fluorite | Level 6

Oh I see! thanks!

Ksharp
Super User

I remembered @Rick_SAS  wrote a blog about analysis NBA data by using two different non-parameter logistic regression .

Rick_SAS
SAS Super FREQ

Yes, you can use PROC ADAPTIVEREG for univariate analysis. "Multivariate" means "one or more" in this situation. Here is some data and an example:

 

data Cars;
set sashelp.cars;
where Origin in ('Asia', 'USA');
Event = (Origin="USA");   /* equivalent 0/1 binary numerical response */
run;

proc sort data=cars;
by weight;
run;
proc adaptivereg data=cars; model Origin(event="USA") = weight; output out=AdaptiveOut p(ilink); run; proc sgplot data=AdaptiveOut noautolegend; scatter x=weight y=Event / jitter jitterwidth=0.1; series x=weight y=Pred; yaxis min=0 max=1 grid label="Predicted Probability" offsetmax=0.1 offsetmin=0.1; run;

 

As Paige and others have said, you can also use spline effects with PROC LOGISTIC. For a discussion, see the article "Regression with restricted cubic splines in SAS". Here is an example, modified from that article:

 

/* create sample data; sort by independent variable for graphing */
data Cars;
set sashelp.cars;
where Origin in ('Asia', 'USA');
Event = (Origin="USA");   /* equivalent 0/1 binary numerical response */
run;

proc sort data=cars;
   by weight;
run;
 
/* Fit data by using restricted cubic splines.
   The EFFECT statement is supported by many procedures: */
title "Restricted Cubic Spline Regression";
proc logistic data=cars plots=none;
  effect spl = spline(weight / details naturalcubic basis=tpf(noint)                 
                               knotmethod=percentiles(5) );
   model Origin(event="USA") = spl;       /* fit model by using spline effects */
   output out=SplineOut predicted=PredProb;    /* output predicted values for graphing */
quit;
 
proc sgplot data=SplineOut noautolegend;
   scatter x=weight y=Event / jitter jitterwidth=0.1;
   series x=weight y=PredProb;
   yaxis min=0 max=1 grid label="Predicted Probability" offsetmax=0.1 offsetmin=0.1;
run;
Daniellekeem
Fluorite | Level 6

Thank you so much!!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 985 views
  • 12 likes
  • 5 in conversation