BookmarkSubscribeRSS Feed
stellapersis7
Obsidian | Level 7

Hi all,

I am student and doing a project, so I am confused about a linearity assumption of a continuous independent variable which is included in the model.

My aim is to check the graphs between gestage and estimated probability for genders male and female.

I need to check when the variable is included as 1) categorical and 2) continuous, if the linearity assumption is met.

My code is 

proc genmod data = SAS.z_final descending;

class gender  under_weight  QNO;

model under_weight = gender gestage /dist=b link=logit type1 type3;

repeated subject = QNO/ corr=cs corrw;

output out = pain pred=p resraw=r;

run;

My question is how to get the linearity assumptions for the independent variable gestage as continuous and categorical variables for gender(independent categorical variable) male and female?

3 REPLIES 3
PaigeMiller
Diamond | Level 26

For continuous X in a logistic regression, this is suggested in the SAS FASTats:

 

Linearity in the logit (or link), testingTo test for nonlinearity in the logit (for logistic models) and more generally for finding a suitable functional form for an independent variable in a generalized linear model (GLM), use the spline smoother on the variable in SAS/STAT PROC GAMPL or SAS Viya PROC GAMMOD. See the example titled "Nonparametric Logistic Regression" in the GAMPL documentation. Also see the ASSESS statement in SAS/STAT PROC GENMOD for assessing the covariate or link function in a GLM or Generalized Estimating Equations (GEE) model.

Also https://www.lexjansen.com/sesug/2019/SESUG2019_Paper-233_Final_PDF.pdf

 

https://stats.stackexchange.com/questions/169348/how-should-i-check-the-assumption-of-linearity-to-t... points to using the Box-Tidwell test.

 

Checking linearity for categorical predictor makes no sense.

--
Paige Miller
Ksharp
Super User
Paige,
Sure. I forgot the "ASSESS statement in PROC GENMOD " .

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1336 views
  • 0 likes
  • 3 in conversation