# mixed categorical/continuous model

I am modelling a set of data coming from an instrument read-out, which can range across the following values

• less than the instrument low-end read-out limit
• continuous value when in the range the instrument can read
• greater than the instrument upper-end read-out limit

I would need to build a model that, for a set of new objects, predicts the experimental read-out as a continuous (if predicted to be whithin experimental read-out range) or categorical (if predicted to be lower or above experimental read-out)

Is there any statistical model that can do the job all at once?

Thanks

• At what level are you asking this question? Are you looking for a theoretical model/algorithm? Or are you looking for a package in a specific programming language that can do this? Or are you looking at a function is for example Excel or SPSS that can do this for you? – dimpol Oct 24 '16 at 9:37

After thinking it over I came up with 2 ways of approaching the problem on a theoretical level. Basically: regression first and then catagorization or vice versa.

With regression first you could rescale the training-values to be from 0 to 1, instead of from lower limit to upper limit. For the values out of range, you could set the values below the measurement range to 0 and those above it to 1. Then you could do regular regression with a sigmoid output function. After training you could set 2 thresholds, using a categorization algorithm, to split the output in the 3 groups.
So to predict a value you first run to through the regression algorithm. Then compare the output of the regression (which is between 0 and 1 due to the sigmoid) to the 2 thresholds found through the categorization. If it is between the thresholds, just take that value as the continuous prediction. Then rescale to get back to the appropriate range.
If it is above the upper threshold or below the lower threshold, categorize as above or below the measurement range.

The second approach is the other way around. First categorize the data into the 3 groups and then use ordinal regression to predict for a given value in which group it is. Then apply regression on the examples that are in the middle group.

I expect the first approach to have less accurate categorization. This will be caused by the fact that a training-example at the very low end of the range and an example below the measurement range will have very similar target values. However I expect the second approach to have less accurate regression for the middle group. Since the first approach can also use the features of values below the measurement range to determine which training-examples have a very low output (and similarly at the high end of the range).
My advice would be to try both and compare them. Which is better will be determined both by how well they perform in practice and how you value categorization errors versus regression errors.

• thanks for your answer - I quite like your first idea but I'm not quite sure I understand what you mean by "regular regression with a sigmoid output function". Would you mind to spend some more words on it? Thanks – mimenico Oct 24 '16 at 12:14
• Well, most regression algorithms have an unrestricted output. So if you give it a lot of examples between 0 and 1, you might get a prediction of -0.1 for a new example. However this is obviously non-sense. If you feed it in a logistic function, you are guaranteed to get an output between 0 and 1. Also, it encourages a bigger seperation between values close to the lower limit and those equal to the lower limit. If you want to get the sigmoid to output 0.001, you need to input it -6.9. However if you want it to output 0, you need to input it -infinity. This is a good basis for categorization. – dimpol Oct 24 '16 at 12:35