Data structure [🇷 for BE/BA]

posted by Helmut Homepage – Vienna, Austria, 2017-02-08 11:33 (3055 d 02:31 ago) – Posting: # 17036
Views: 19,646

Hi StatR,

 Subject Formula Period Sequence     Yijk

       1       1      1        1 4.933014

       1       0      2        1 5.006829

       1       1      3        1 4.854162

       1       0      4        1 5.081755

...


❝ Where Yijk is the PK characteristic. The first sequence represents "TRTR" and the second sequence: "RTRT". In the formula 1 = T and 0 = R.


Only a general remark about data structures in R. I suggest to code categorial (classification) variables as characters instead of numeric (Treatment, Sequence). It not only helps others to understand what you have meant without requiring an explanation (1=TRTR, 2=RTRT and 1=T, 0=R) but also models (e.g., lm(), lme(), lmer()) will automatically treat them as factors. Avoid Formula and use Treatment or Formulation instead. Personally I prefer Treatment over Formulation for generality (imagine a food-effect study where we have the same formulation).
Convert numeric variables (except the PK-response) to factors as well:

data$Subject <- as.factor(data$Subject)
data$Period  <- as.factor(data$Period)


❝ Unfortunately, I am confused after reading tons of post, and I could not figure out what is "trt", "tmt" ...


Always the treatment is meant. To add confusion in package bear Yung-jin uses drug. ;-)

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,424 posts in 4,927 threads, 1,672 registered users;
38 visitors (0 registered, 38 guests [including 7 identified bots]).
Forum time: 15:04 CEST (Europe/Vienna)

Medical researches can be divided into two sorts:
those who think that meta is better and those
who believe that pooling is fooling.    Stephen Senn

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