0

I have a time series dataset where each data point contains a categorical rating. To use the dataset in regression analysis, I linearly transformed my dataset by replacing each category string with a corresponding number drawn from a linear sequence (say, A = 1, B = 2, C = 3, ..., Z = 26).

However, I would still like to have some plots that depict the development of the rating over time. Ideally, I would want the y-axis to be labeled with the original category, rather than the number I applied in the transformation. Is that possible?

EDIT: The observations are labeled. So, essentially I would like to use the labels, rather than the values on the y-axis.

Nick Cox
  • 35,529
  • 6
  • 31
  • 47
altabq
  • 1,322
  • 1
  • 20
  • 33
  • 1
    A secondary question in return is whether categories mapped A,...,Z to 1,...,26 are rendered suitable for regression. That makes a rather strong assumption about your scale. – Nick Cox Jan 30 '14 at 12:51
  • I've looked into that already. Linear isn't ideal in every respect but it's the most commonly used. – altabq Jan 31 '14 at 13:50
  • As they say, it's your problem. Linear regression isn't in principle well suited to bounded variables, i.e. if the range of possible values is just 1 to 26, then linear fits won't respect that. That may or may not bite. – Nick Cox Jan 31 '14 at 14:31
  • What alternative method would you recommend then? – altabq Jan 31 '14 at 18:19
  • Something like ordered logit is the most obvious alternative, but with 26 categories that could be problematic for other reasons. No magic fix is evident. – Nick Cox Jan 31 '14 at 18:24
  • Thanks. I will estimate an ordered logit for comparison. I was also wondering if an exponential or logistic transformation might be more suitable a method since differences between each rating notch are likely to be weighted differently by observers. Would you mind if I send you am email to your Durham address, explaining a little more what exactly I'm doing? I very much appreciate your feedback on my research. – altabq Feb 02 '14 at 16:11
  • I'd rather you asked questions in public. – Nick Cox Feb 03 '14 at 00:05

2 Answers2

4

You could use the value labels:

tsline var_X, ylabel(1/26, valuelabel)
Maarten Buis
  • 2,684
  • 12
  • 17
0

Found an answer. The y-axis can be manuall replace by using the plot option ylabel. E.g.

global ylabels 1 "A" 2 "B" 3 "C"
tsline var_X, ylabel($ylabel)

would replace values 1-3 on the y-axis by A, B, C.

altabq
  • 1,322
  • 1
  • 20
  • 33