Data structure [🇷 for BE/BA]

posted by Helmut Homepage – Vienna, Austria, 2017-02-08 11:33 (2965 d 03:21 ago) – Posting: # 17036
Views: 19,087

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,409 posts in 4,921 threads, 1,669 registered users;
18 visitors (0 registered, 18 guests [including 3 identified bots]).
Forum time: 14:55 CET (Europe/Vienna)

An expert is one who knows more and more
about less and less.    Nicholas Murray Butler

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