I have a table includes the following data:

Status     | Age | Tenure | Function | Gender | Race | Grade Level
Active     |  34 |    1.2 | PSO      | Female | White| 26
Terminated |  24 |    0.2 | Finance  | Male   | Asian| 32
Active     |  50 |    4.0 | HR       | Female | Black| 28
Terminated |  23 |    2.9 | Sales    | Male   | Hispa| 20

I want find out how are the different variables have impact on the binary outcome - Status, and possibly create a predictive modeling to predict the outcome of Status based on the other variables.

Where do I start? I am thinking of doing a factor analysis to find the P-value for each factor. Is that a right path?


2 Answers 2


The most obvious thing that comes in mind would be binary response models. In your case I would probably recommend applying logistic regression. It can be done using glm function (for Generalized Linear Models) in R. In this case

glm(formula = Status ~ Age + Tenure + Function + Gender + Race + Grade Level , 
    family = binomial(logit), data = yourdata)
  • $\begingroup$ I used this statement glm(formula = status ~ age + sex + race + function + grade + tenure, family = binomial(logit), data = data), it is giving me an error msg: Error: unexpected '+' in "glm(formula = status ~ age + sex + race + function +". What did I do wrong? :( $\endgroup$
    – PMa
    Jan 6, 2014 at 5:54
  • $\begingroup$ Problem is that column Function corresponds to one of R language keywords and it thinks that you want to start writing function. Simplest solution to rename that column. You can retrieve your column name vector aux<-colnames(yourdata) then change the appropriate value in aux[4]="func" and then update column names by colnames(yourdata)<-aux . $\endgroup$
    – user974514
    Jan 6, 2014 at 6:14
  • $\begingroup$ I would just add that using link=logit is not the only option, the other two commonly used ones being probit and cloglog. For a discussion on how to choose the link function and in general on binomail models you may also want to have a look at chapter 2 of "Extending the linear model with R" by Julian Faraway. $\endgroup$
    – nico
    Jan 6, 2014 at 7:30
  • $\begingroup$ @user974514 - thanks, I changed the col header to func based on the method you provided and it worked :) $\endgroup$
    – PMa
    Jan 6, 2014 at 17:24
  • 1
    $\begingroup$ this maybe a stupid question, but does the target variable, in my case Status need to be numbers, i.e. 0 and 1 rather than 'Active' vs. 'Terminated'? $\endgroup$
    – PMa
    Jan 6, 2014 at 21:01

This is a logistic regression question. You can fit a model like fit <- (status ~ age + tenure + function...). This can be done with a variety of techniques, I recommend the package rms. You may also want to review Frank Harrell's book. You can validate, calibrate, plot, derive a formula, etc using the functions in the package.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.