This is a question I found surprisingly hard to answer using Google: How is interval scaled data implemented in R? For nominal, its factor(), for ordinal, it's ordered(), and for ratio scale, it's numeric(). Now I understand that it's easy to use numeric for interval scale variables as well. But the point about these data types is that addition will fail on factor() and ordered() variables, and greater/lesser comparisons fail on factor(), but not on ordered(). Likewise, is there a datatype for interval data that allows for addition and subtraction, but not division and multiplication?
1 Answer
Partially answered in comments:
The meaning of a measurement scale is at best only loosely and indirectly connected with a computer data type. Conflating those two may be creating a lot of confusion--which explains the difficulty in researching this with Google. In particular, there is no sense of "failure" (of division, etc) in a measurement type. The definition of type depends on which relationships among numbers remain meaningful as the numeric representation is modified in an allowable way. Although your question raises many issues, as asked it really is unanswerable.
– whuber
I suspect reading over Lord's paper might indicate the sense in which few statistical tests actually "rely on" or require data on a particular scale and reveal why creating such a datatype might be counterproductive. Even procedures designed for count data have been effectively applied to data represented as real numbers.
– whuber
Another viewpoint: A-reanalysis-of-Lords-statistical-treatment-of-football-numbers
Thank you for sharing that. The literature is much larger--Lord's paper engendered many, many reactions. Although your particular reference decides Lord was wrong, their conclusion backs up my suggestion that this direction you are heading in--of attempting to enforce some kind of "measurement scale" as a computing data type--may be unwise. Don't misunderstand me: I think there is a place for strongly typed statistical computing languages (of which R is decidedly not an example). Just don't confuse measurement type with data type!
– whuber
R
: it's not inherent in the concept. A nice exposition was published by F.M. Lord as "On the Statistical Treatment of Football Numbers:" you can Google that. I am unable to propose a better question because I'm not quite sure where you trying to go with this or what you're trying to accomplish. $\endgroup$R
is decidedly not an example). Just don't confuse measurement type with data type! $\endgroup$