# Feature engineering with MNAR data

I have logs from a user's keyboard, mouse, and a few other things. I am trying to use them in order to do some predictions. Exploring the data and trying some feature engineering, I have discovered that the Hold Time (duration between when a key is pressed and released in milliseconds) seems very promising.

In order to make predictions, the data is aggregated to be in the following form:

__________| keys pressed | mouse clicks | hold time mean |...| label
minute 1  |     X_11     |      X_12    |       X_13     |...| y_1
minute 2  |     X_21     |      X_22    |       X_23     |...| y_2
...              ...             ...             ...      ...  ...
minute N  |     X_N1     |      X_N2    |       X_N3     |...| y_N


The issue is that sometimes, a user would spend a minute without typing and thus computing a Hold Time mean makes no sense and creates a missing value. This obviously only happens when the value for keys pressed is zero.

I do not know how to handle these missing values. I do not want to drop all entries where the user was not typing, because I can rely on other features to do predictions in those cases. I thought that maybe putting the Hold Time mean to zero would make sense, since indeed the amount of time a key was held is zero, but this must bias my model?

Would anybody have any recommendation how to deal with this?

In this case, the 0 in keys pressed predicts missing data in hold time mean. Does any other field with data predict hold time mean? That in itself can be an interesting finding. You could also try to reformat your data where time is nested in observations (i.e., from a 'wide' format to a 'long' format), which would allow a longitudinal hierarchical linear model. In these kinds of models, listwise deletion is less deleterious.
• Your model might look like this: $Level 1:$ $hold.time.mean=\beta_0+\beta_1(minute_{ij})+e_{ij}$ $Level 2:$ $\beta_0=\gamma_00+\gamma_01(keys.pressed_j)+\gamma_02(mouse.clicks_j)+U_0$ $\beta_1=\gamma_00+\gamma_01(keys.pressed_j)+\gamma_02(mouse.clicks_j)+U_1$ – Jay Schyler Raadt Dec 11 '17 at 14:41