# How to model variables, where instead of values we observe intervals?

Consider a case where instead of observing actual variable values, we are observing variable range. The possible range-values could be enumerated (i.e. could be a fixed set of values, for e.g. fixed age-group ranges) or could be observation specific (and might overlap).

In the former case, the variable could be treated as an ordinal variable. (Based on @whuber's comments, treating this variable as an ordinal variable seems an unnecessary restriction). Is anything similar possible for the latter case? Are there any other methods to analyze such data?

I am interested in general treatment for analyzing interval data variables - as an output variable as well as an input variable to a model. Also, if there are any exploratory data analysis methods for such variables.

• Could you expand on what you mean by "observe" a range? Making multiple observations and recording only their range may be conceptualized, modeled, and analyzed differently than, say, making a single observation of an interval value (as occurs in many kinds of censoring, for instance or in recording binned values like age groups). I find your suggestion to treat (possibly overlapping) ranges as "ordinal variables" to be particularly confusing because I see neither how it would be done nor what, if any, advantage it might have for data analysis. – whuber Jul 22 '13 at 20:02
• @whuber, I meant observing an interval value, similar to age-groups one can have salary-ranges and here, I am assuming the ranges to be non-overlapping (and hence treating them as ordinal). The other case where range values are observation specific, I meant the end values are decided by the user and hence may or may not overlap. I am sorry for not being able to put this succinctly. Let me know if this is now clear. – steadyfish Jul 22 '13 at 20:19
• Your second case often is fundamentally different from the first: there may be an association between the endpoints chosen by the user and other variables; this possibility should be part of the modeling and the analysis. Such situations also occur when variables are binned in a post hoc manner based on their values. At a minimum that causes a loss of "degrees of freedom" in statistical tests. In your first case, I still see no good reason to recommend treating binned values as ordinal solely because they are binned. – whuber Jul 22 '13 at 20:27
• Are you looking for ordinal regression, or is that too obvious? en.wikipedia.org/wiki/Ordinal_regression – Peter Ellis Jul 23 '13 at 7:34
• I we may have different conceptions of what an "ordinal" variable is. When data are binned or otherwise expressed as intervals, that does not necessarily make them ordinal: it merely limits their precision. Not only can such data still be compared (provided their ranges do not overlap), but the values represented by the ranges maintain whatever meanings they originally had: if originally differences or ratios of those values made sense, then differences and ratios of the interval-valued expressions make equal sense. You seem to rule this out by fiat, creating an unnecessary restriction. – whuber Jul 23 '13 at 14:31

In Stata, both cases can be handled with the interval regression command intreg, which is generalization of the Tobit. It can handle point, interval, or left/right censored data (or a mixture of them all). It does assume error term normality, but the log transformation can often work if your data require and permit it.

I am not sure if there are canned non-Stata implementations, but there are formulas and references at the end of the manual link. It is a fairly straight-forward likelihood function that should be fairly easy to maximize. There's also a nice comparison between the ordered probit approach and interval regression using the value of the log likelihood for the first case scenario.

Here's a very simple simulation with $N=5000, Y=\alpha + \beta \cdot X + \varepsilon =\frac{1}{2} + 1 \cdot X + \mathcal{N}[0,1]$:

#delimit;
clear all;

set seed 10011979;
set obs 5000;

gen x = rnormal();
gen ystar = 0.5 + 1*x + rnormal();
gen ylb = ystar - int((5-1)*runiform());
gen yub = ystar + int((5-1)*runiform());

intreg ylb yub x;


Every observation has a variable interval constructed by adding/subtracting a random uniform number to the true value, so the intervals may overlap. The data basically looks like this: As you can see, 2 observations are uncensored (i.e., point data).

The output is:

Interval regression                               Number of obs   =    5000
LR chi2(1)      =    2102.49
Log likelihood = -3580.5326                       Prob > chi2     =     0.0000

------------------------------------------------------------------------------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
x |    .979912   .0192016    51.03   0.000     .9422775    1.017546
_cons |   .4757097   .0190327    24.99   0.000     .4384063    .5130131
-------------+----------------------------------------------------------------
/lnsigma |   .0336532   .0143186     2.35   0.019     .0055893    .0617171
-------------+----------------------------------------------------------------
sigma |   1.034226   .0148086                      1.005605    1.063661
------------------------------------------------------------------------------

Observation summary:         0  left-censored observations
326     uncensored observations
0 right-censored observations
4674       interval observations


It seems like all the parameters, including the standard deviation of the error, are fairly close to the true values.

• Thanks for your answer. I checked out the link you've mentioned, just based on examples provided, it seems this command only allows interval response variables with non-overlapping range. Do you happen to know whether this is true? Any references? – steadyfish Jul 23 '13 at 13:09
• Just to add, I am interested in analyzing interval data variable in general, not just as a response variable.. – steadyfish Jul 23 '13 at 13:13
• The examples in the manuals are usually simple. In any case, I added an example that I hope is convincing. If you want the interval variable on the right hand side, I would try to enter them as a set of dummies. Obviously this will only work with a coarser interval scheme since you can't have a dummy for every observation. – Dimitriy V. Masterov Jul 23 '13 at 18:07

You are looking for interval regression: In R you can use the survival package as explained here

Or you can try with the intReg package using the intReg function

• Thanks for your answer. I checked out both the packages. Just based on examples provided, it seems survival package only allows interval response variables with non-overlapping range. The intReg package though does seem to allow arbitrary user specific interval variables. – steadyfish Jul 23 '13 at 13:06
• Just to add, I am interested in analyzing interval data variable in general, not just as a response variable.. – steadyfish Jul 23 '13 at 13:14
• Using interval data as a predictor seems more conflictive since you are introducing measurement error with each observation. – Aghila Jul 23 '13 at 19:19
• Yes, every observation will have measurement error, but i think, it's better to somehow incorporate such variables rather than not using them at all. – steadyfish Aug 8 '13 at 17:25