# How should I set up my data for classification when there is a time component?

I am assuming there is an optimal why to set up my data to achieve my goal of predicting who will retire next year.

I can think of two methods. Which do you think is the most appropriate and why? Or if you can think of another alternative please let me know. Would your answer be different if I wanted to know who is likely to retire in the next two years? three years?

Each method assumes 5 years of training data, for example 2008 - 2012 to predict who will retire in 2013.

Method 1

• Include a row of data for each employee for each year that they are active (did not retire) and one row for when they retire. In the year that they retire they generally have two rows (one for active and one for retire).
• Each active year is snapshot employee data as of January 1st. Retiree data is as of date of retirement.
• Example scenarios are provided below.

Method 2

• Include one row of data for each employee that was active (did not retire) during the entire time period and one row for each employee that retired. In this example each employee only appears once in the training set.

BACKGROUND:

• I'm trying to predict who is likely to retire next year.
• Population: All employees who are 55 years of age or older and have at least 5 years of service.
• I'm using Random Forest (I have began experimenting w/ logistic regression...not much experience though).
• I have a binary outcome and my predictors are made of both continuous and factor variables. My binary outcome is retire or not-retire (continued working). Examples of continuous variables are age of employee, years they were with the company and salary. Examples of factor variables are retirement plan type (pension or 401k), job type (exempt vs. non-exempt),Highest Education Level, Department.

Method 1 Data Examples (predicting '13)

• Person A was here '08 through '12 and retired on '13
• Person B was here '08 through '11 and retired on '12
• Person C was here '08 through '13
• Person D retired in '08 (he was here previous years too but the training data in the example only goes back to '08)
• It sounds like this might be handled as a survival-analysis problem with age as the time variable, retirement as the "event", and the other variables as predictors. Have you considered that approach?
– EdM
Commented Jun 6, 2015 at 15:42