Variable names, lexical order? [Regulatives / Guidelines]

posted by Helmut Homepage – Vienna, Austria, 2023-04-21 17:45 (593 d 08:39 ago) – Posting: # 23535
Views: 2,434

Hi David or Guo,

❝ 1. […] please change my username as "Weiguo21224" at your end.


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 [image]:
  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 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

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

Complete thread:

UA Flag
Activity
 Admin contact
23,332 posts in 4,899 threads, 1,660 registered users;
17 visitors (0 registered, 17 guests [including 7 identified bots]).
Forum time: 01:24 CET (Europe/Vienna)

I don’t write drafts.
I write from the beginning to the end,
and when it’s finished, it’s done.    Clifford Geertz

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5