Search code examples
rregressionlogistic-regressionfeature-selection

Equivalent of SignifReg function in R for logit regressions?


I am hoping to run some relatively simple code in R to help determine which independent variables would be meaningful based on their p-value in a logistic regression. I know that the SignifReg function exists to help determine meaningful variables for lm objects, but is there a similar function/package that exists for logits? Thanks!

The SignifReg function is part of the SignifReg package, and more info can be found here: https://www.rdocumentation.org/packages/SignifReg/versions/3.0/topics/SignifReg


Solution

  • The package rms has a function fastbw which takes models as logistic, coxph. It is based on Lawless and Singhal (1978), 'a first-order approximation that has greater numerical efficiency than full backward selection'. eg:

    Glmfullfit = Glm (Hypertension ~ ., family = binomial, data = mydata) #Glm from rms. 
    fastbw(Glmfullfit, rule= 'p', type='individual', sls=.1) #retention pvalue = 0.1.         
    

    In SAS, the equivalent code is selection method = backward(fast) [I did not try this code due to SAS cloud). Don't use the coefficients from the fastbw results due to the methodology used in fastbw. Take the final survived variables and fit with glm for coefficients and other parameters.