ElMaestro
★★★

Denmark,
2020-08-10 14:16
(209 d 08:25 ago)

Posting: # 21850
Views: 1,629

## Mixed models, did someone figure out lme? [R for BE/BA]

Hi all,

Oh, how life throws you a curve ball every now and then....

As you know I am writing optimisers and algos for REML fits for replicated and semireplicated BE designs.
For replicated (2x2x4) I'd like to have something to compare with. As I am neither rich nor well connected I can't get access to SAS or WinNonlin, but lucky me, there are free packages and functions in R for mixed models.
I gather lmer does not allow for different within-variances, so I am looking at lme.

Is lme the most hostile and poorly documented function ever in existence??
I have no idea how to use it after having read the docs approximately 50 million times; all I want is to fit a model with five variance components:
Within Ref, within Test, between Ref, between Test, and their covariance.

I once had the book by Pinheiro & Bates and it is a terrible document for anyone trying to get familiar with mixed models. I think it went into the burner a cold November night 10 years ago. You need to know and understand all structures and syntax examples before anything in that book makes sense. So nothing makes sense to me, obviously. A bit like real life, you might say.

So, I was thinking the bebac forum must come to my rescue and I read with equal amounts of joy and equal amounts of horror this old post written by one of the greatest of the truly great.

Does it really have to be that hard??
I googled around but I have not really seen much about lme for BE. Where do I start, does anyone have suggestions on how to use lme for a 224BE design and be able to extract meaningful variance components? Did anyone since then figure out easier and possibly more meaningful ways to work with lme such that the model is clearly defined in an understandable way and such that extraction of swr and swt is not plain meaningless torture?

Mixed models are no good for my mental health.
Many thanks.

Pass or fail!
ElMaestro
PharmCat
★

Russia,
2020-08-10 22:19
(209 d 00:21 ago)

@ ElMaestro
Posting: # 21853
Views: 1,263

## Mixed models, did someone figure out lme?

» Hi all,

Hi ElMaestro, it's me again.

Bates went to Julia and work on MixedModels.jl. I and many people asked how to make custom G and R structure in this package. As I know - there are no method to make some like CSH or VC for R matrix, and all issues on github to make it is closed. I think this is the position of developers.

MixedModels.jl package for Julia seems like port of lme package for R project, I think lme have equivalent limitation because PIRLS used in both cases.

From my side was made attempt to build package for bioequivalence replicate design in Julia. It work fine for all basic designs (sometimes better than SPSS), but have some limitations: no choice for variance structure, only CSH+VC, 2 formulations, strict model. You can find it here. Source is open and I try to document is clearly.

PS There are some ways to make product for general purpose (like SPSS), but it is very big job even to make good tipization for data and process. Also make good API it's a monster task. So, some more techniks I will try to implement to ReplicateBE.jl (gradient and hessian computation, some structure choice, linear algebra optimizations).
d_labes
★★★

Berlin, Germany,
2020-08-11 13:20
(208 d 09:20 ago)

@ ElMaestro
Posting: # 21856
Views: 785

## Mixed models, did someone figure out lme?

Dear Öberster größter Meister,

what was the question?

You may find here some hints for using nlme/lme() in evaluation of replicate cross-over designs.

Regards,

Detlew
ElMaestro
★★★

Denmark,
2020-08-11 14:42
(208 d 07:59 ago)

@ d_labes
Posting: # 21857
Views: 768

## Mixed models, did someone figure out lme?

Hi d_labes,

» what was the question?

The question is, how to fit a relevant model with lme and how to extract relevant variance components in an easy way? (as in, easier than in the post linked to).

» You may find here some hints for using nlme/lme() in evaluation of replicate cross-over designs.

I read the post many times since you originally posted it
But I am none the wiser even after reading it many times. So, I feel I have an ok understanding of the mixed model, and I have an ok understanding of which variance components I can reasonably ask for; the next step is then to ask lme to get me what I want in an intuitive fashion. That last thing is not easy, and books like Pinheiro & Bates do not really get me there.

For example: I prefer to play with variance components directly without involvement of rho (correlation) for the covariance of T and R. Where do I start? Playing around with weights, correlation structure, etc may get me what I want (see the two threads linkeda above), but that stil does not mean I am using lme meaningfully or optimally, I feel.

Pass or fail!
ElMaestro
d_labes
★★★

Berlin, Germany,
2020-08-11 18:23
(208 d 04:18 ago)

@ ElMaestro
Posting: # 21858
Views: 761

## Mixed models, did someone figure out lme?

Dear ElMaestro,

» ...
» For example: I prefer to play with variance components directly without involvement of rho (correlation) for the covariance of T and R. Where do I start? Playing around with weights, correlation structure, etc may get me what I want (see the two threads linked above), but that stil does not mean I am using lme meaningfully or optimally, I feel.

OK. That was my feeling in using Proc MIXED too.
And later on in the implementation via nlme/lme().

But life is no musical request programm .
To have a stil you are satisfied with: Build your software by your own.

If I see your activity here in the forum (together with PharmCat) I think you will be able to do so. Contrary to me. Too small a brain to follow your posts. Even the easiest statements are out of my intellectual reach.

Thus I can't help. Sorry.

Regards,

Detlew
ElMaestro
★★★

Denmark,
2020-08-12 09:38
(207 d 13:02 ago)

@ d_labes
Posting: # 21862
Views: 735

## Mixed models, did someone figure out lme?

Hi d_labes,

thanks for an encouraging post.

» If I see your activity here in the forum (together with PharmCat) I think you will be able to do so. Contrary to me. Too small a brain to follow your posts. Even the easiest statements are out of my intellectual reach.

I am totally 120% sure you are being too modest there

Pass or fail!
ElMaestro