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?
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.
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!
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.
Ready to level-up your skills? Choose your own adventure.