-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAS Proc Mixed: random element #300
Comments
Thanks @WouterMpublic , I guess this would need random effects, so a structure for the covariance which is not nested within the subjects - and we don't allow this in the mmrm package. Mainly to keep things simple in terms of implementation and scope. If there is enough interest we might think more in this direction but it would be a very big change I think... |
Hi @danielinteractive , thank you for the quick response. Clear that it is for now not possible, and quite a big change to make. I noticed in the nlme package with function lme that they do have a random option, next to the correlation. Maybe this can be of inspiration, but I might be completely wrong here as well ;). (I'm still struggling to get the nlme::lme working as I intend, but making progress!). |
In the FDA draft guidance for bioequivalence studies also the combination of repeated measures and random effects is needed: |
Relatedly, for the bioequivalence analysis specification I found the Julia package https://github.com/PharmCat/ReplicateBE.jl and a corresponding manuscript by @PharmCat. It seems very relevant if we want to go in this direction |
I thought I'd chime in to say that I also would very much appreciate if the mmrm package could be extended to handle random effects, as SAS and SPSS can. I frequently analyse group psychotherapy datasets where there are repeated observations per patient, and the patients are nested within groups. Ideally I'd model the within-patient covariance structure using one of the options available in mmrm (AR1, UN, etc) and fit a random intercept to deal with the nesting of patients within groups. Currently there is no good solution in R to run those models. mmrm has a great array of repeated covariance structures and good options for hypothesis testing (Satterthwaite and Kenward-Roger DF), but doesn't handle random terms. The random functionality would also be helpful for analysing trials with many sites, where it might be desired to model site as a random term rather than fixed factor. |
Thanks @gitrman ! Much appreciated. So far, almost all the practical examples involved random intercept terms for groups of subjects. I wonder if we could get a specialized solution for this use case relatively easily. But I would need to dedicate some time for looking into the details... |
Hi! It is very computationally hard problem. In pure R any solution will be slow and maybe memory greed. You can try to use Metida.jl (https://github.com/PharmCat/Metida.jl) for Julia - this package is "evolution" of ReplicateBE.jl for most LMM problems (random and repeated effects with flexible covariance structure models) (or MixedModels.jl if you don't need structured repeated effects). For Julia you also can find CSV.jl, DataFrames.jl for any work with tables (GLM.jl HypothesisTest.jl and other for statistics). Most statistical tasks can be solved with Julia packages. |
Thanks @PharmCat, great to hear from you. I definitely want to try out |
Hi! I just use REML optimization with Newton (Hessian required) method, some minimal details you can find in docs (https://pharmcat.github.io/Metida.jl/dev/details/). So as Julia ecosystem have ForwardDiff.jl for forward differentiation - Metida.jl doesn |
Thought I'd mention that I came across a paper today that evaluated the type of model we've been discussing in this issue in the the context of cluster RCTs. The used an unstructured residual covariance matrix plus random intercept for cluster. I thought I'd mention this as it highlights that this kind of model has practical relevance and that it would be great if the mmrm package could be extended to handle it. In the linked paper the authors used SAS and |
I just wanted to chime in as well. I also would like to congratulate the package authors on a fantastic package. I know it would be a very computationally difficult and somewhat challenging problem to incorporate complicated crossed random effects structures into the package. However as someone who performs analysis in both agricultural statistics and veterinary medicine at my university, having the ability to incorporate complex random effect structures in R would be extremely useful. Right now the available packages either lack many covariance structures or proper degrees of freedom computations. It would be amazing to have a such as mmrm package to encompass complicated mixed model anova experimental designs in combination with proper degrees of freedom estimates especially in agricultural statistics where we compute things like split-split plots, strip plots, doubly repeated measures, latin squares and other similar designs regularly. See here for a brief page on some of the types of agricultural experiments we see and compute via proc mixed: https://stats.oarc.ucla.edu/sas/library/sas-librarysas-code-for-some-advanced-experimental-designs/ |
Replicate SAS Proc Mixed in MMRM; how to adress the "random" element from the SAS code in MMRM
In repeated measure studies where we have a randomized complete block design, the blocking of the subjects is an important characteristic that can be taken into account in the statistical model. Can this also be done in MMRM, and if yes how should this look like?
For example the SAS code would look similar to this:
PROC MIXED data=my_data;
CLASS subject block treatment visit;
MODEL y = treatment|visit / DDFM = KENWARDROGER;
RANDOM block;
REPEATED visit / subject= subject type=ar(1);
In MMRM the code looks something like this:
mmrm (
formula = y ~ treatment*visit + ar1(visit | subject),
data = my_data,
method = "Kenward-Roger"
)
Where:
subject = unit on which we retrieve repeated measures
block = group of x subjects equal to amount of treatments in which we randomly decide which subject receives which treatment
visit = time interval for the repeated measure
treatment = x amount of treatments tested in the study
In the MMRM code the line "RANDOM block;" from SAS is missing. Can I still incorporate this in MMRM, and how should this be done?
The text was updated successfully, but these errors were encountered: