0
$\begingroup$

I have a data set with about ~2000 data points. Of these ~1000 actually have features/data. (All 2000 data points have an outcome)

Where there's no data, there is very likely a signal. In other words, if I'm not able to get data for that data point, that's significant in and of itself, and there is a big difference in the target variable when there is data and when there's not data.

The problem is that rpart shows me that these missing values result in "observations deleted due to missingness," so the model doesn't make any

Is there a way to set up an rpart model such that it makes a prediction on data points with no features (i.e. the only variable available is the outcome)?

my_model <- rpart(bad ~ count_found, data = mydata)
$\endgroup$
2
  • $\begingroup$ You mean outcome without any explanatory variables? A signal in outcome variable must relate to something. Most often a signal is a time series or an ordered series. So there's at least the time or rank variable. $\endgroup$ Commented Feb 12, 2014 at 23:36
  • $\begingroup$ That's exactly what I mean. In this weird case, the absence of any explanatory variables is a signal, and given the lack of data, it's useful. I could just add an if statement that is "if there is no explanatory variable, AAA is the projected outcome, otherwise use the model" but it would be ideal if I could have a single model object. Maybe I could just add a factor variable "has_data" to the test set, and set it to level 1 if there is data and level 2 if there is not? $\endgroup$
    – user35581
    Commented Feb 13, 2014 at 14:23

1 Answer 1

1
$\begingroup$

For the record, the best solutions I have found are to:

  1. Impute missing values (not ideal)
  2. create a second column for every column with missing values. This second column would be a n indicator if the first column was missing or not. Then fill in the missing values in the first column with a default value.
$\endgroup$

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.