Getting variance components [🇷 for BE/BA]

posted by d_labes  – Berlin, Germany, 2017-02-08 11:13 (2606 d 01:37 ago) – Posting: # 17034
Views: 17,763

Dear StatR,

sorry for confusing you. I was a little bit sloppy in the post and mixed the factor names in Bear with mine.

To clarify my naming convention and coding:
tmt is treatment coded as "T" or "R"
period is period no
sequence is sequence coded as "TRTR" or "RTRT" (or whatever you have)
subject is subject no.
y is log-transformed PK metric (Cmax or AUC or whatever you like to evaluate)

Don't forget to make them as.factor()!

Then call
muddle <- lme(y ~ tmt + period + sequence,
              # random variance-covariance matrix
              random= ~ tmt-1|subject,
              #different within variabilities                 
              weights=varIdent(form = ~ 1 | tmt),
              data=EMAsetII, method="REML")


If you prefer your numeric coding of tmt = Formula and Sequence:
Don't forget to make them as.factor()!
Then call
muddle <- lme(y ~ Formula + Period + Sequence,
              random= ~ Formula-1|subject,
              weights=varIdent(form = ~ 1 | Formula),
              data=EMAsetII, method="REML")


Using the dataset II from the EMA Q&A you will get the following output with my convention:
Linear mixed-effects model fit by REML
  Data: EMAsetII
  Log-restricted-likelihood: 15.33728
  Fixed: y ~ tmt + period + sequence
(Intercept)        tmtT     period2     period3 sequenceRTR sequenceTRR
7.904258602 0.022391427 0.001296055 0.048118876 0.054776131 0.050923729

Random effects:
 Formula: ~tmt - 1 | subject
 Structure: General positive-definite, Log-Cholesky parametrization
         StdDev     Corr
tmtR     0.19030500 tmtR
tmtT     0.24869920 0.964
Residual 0.09296929     

Variance function:
 Structure: Different standard deviations per stratum
 Formula: ~1 | tmt
 Parameter estimates:
       T        R
1.000000 1.237973
Number of Observations: 72
Number of Groups: 24


From that it is read (note that lme() works with SD instead of variances):
s2wT = 0.09296929^2
s2wR = (0.09296929*1.237973)^2 = 0.1150935^2
s2bT = 0.24869920^2
s2bR = 0.19030500^2
rho = 0.964 (unfortunately no more decimals)

Hope this helps.
Homework: Identify the variance-covariance terms with your coding :cool:.

Regards,

Detlew

Complete thread:

UA Flag
Activity
 Admin contact
22,957 posts in 4,819 threads, 1,636 registered users;
99 visitors (0 registered, 99 guests [including 7 identified bots]).
Forum time: 12:50 CET (Europe/Vienna)

With four parameters I can fit an elephant,
and with five I can make him wiggle his trunk.    John von Neumann

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