## Variable names, lexical order? [Regulatives / Guidelines]

Hi David or Guo,

Done.

❝ 2. I carefully reviewed previous discussion. My understanding is that "T" and "R" in FDA code do represent the "Test drug" and "Reference drug" respectively.

Correct so far.

❝ It should be:

❝ ESTIMATE 'T (the large/later one in lexical order, Reference drug) vs. R (the small/early one in lexical order, Test drug') TRT 1 -1/CL ALPHA=0.1;

❝ Right?

In your example and the FDA’s code, yes and no. Alphanumeric codes are internally converted to factors in lexical order and integers by default. At least in all software I know. Examples in :
1. trt <- as.factor(c("T", "R"))            # T > R print(trt); print(as.integer(trt)) [1] T R Levels: R T [1] 2 1
2. trt <- as.factor(c("Test", "Reference")) # Test > Reference print(trt); print(as.integer(trt)) [1] Test      Reference Levels: Reference Test [1] 2 1
3. trt <- as.factor(c("A", "B"))            # A < B print(trt); print(as.integer(trt)) [1] A B Levels: A B [1] 1 2
4. trt <- as.factor(c("tablet", "capsule")) # tablet > capsule print(trt); print(as.integer(trt)) [1] tablet  capsule Levels: capsule tablet [1] 2 1
In all examples – except the third – the levels of the factors are internally reordered. If you are interested in the contrast (difference) of estimated treatment effects, you have to tell the software which of the treatment is the reference. If you don’t, the one with the internally smallest integer will be subtracted from the larger one. Therefore, in the first example you would get R – T instead of the desired T – R.

Dif-tor heh smusma 🖖🏼 Довге життя Україна!
Helmut Schütz

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes