Data structure [🇷 for BE/BA]

posted by Helmut Homepage – Vienna, Austria, 2017-02-08 11:33 (3403 d 03:08 ago) – Posting: # 17036
Views: 22,336

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,653 posts in 4,991 threads, 1,570 registered users;
471 visitors (0 registered, 471 guests [including 18 identified bots]).
Forum time: 15:41 CEST (Europe/Vienna)

I’m all in favor of the democratic principle
that one idiot is as good as one genius, but I draw the line
when someone takes the next step and concludes
that two idiots are better than one genius.    Leo Szilard

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