Closed hqian-lilly closed 4 months ago
Thanks Hui-Rong for reporting this problem! We are going to look at this with high priority.
root cause of the issue:
y ~ arm + us(visit|id)
, then visit should not be used in emmeans(fit, ~ visit)
X
is not full rank (because the numerical visit is not part of the fixed effect) and there is no linear combinations of x to create the L
such that $L\beta$ is estimablecurrent implementation will discard the visit if the covariance structure is spatial, but I think it will be a better choice to gradually deprecate the use of emmeans(fit, ~ visit)
if visit is not part of a fixed effect.
Hi Daniel, Not sure how this works. Does this fix mean that in the updated mmrm package, we will be able to derive the LSmeans values using emmeans? Another question, in SAS proc mixed, there is an option “nobound” for the variance to allow negative variance, is this implemented in mmrm?
Also I am not completely follow Liming’s initial comments, since in my model, I did have visit as a fixed effect in the model, and generated a second numeric variable (time) to model the variace. I noticed that the variance matrix results is displayed a little bit differently when using sp_exp as an option, which might contribute to the NA calculating the LSmeans values?
I like the mmrm package and really appreciate your effort. Please let me know if I can do anything to help.
Best, Hui-Rong
From: Daniel Sabanes Bove @.> Date: Monday, July 15, 2024 at 7:09 AM To: openpharma/mmrm @.> Cc: Hui-Rong Qian @.>, Author @.> Subject: [EXTERNAL] Re: [openpharma/mmrm] LS estimates using spatial covariance (Issue #446) EXTERNAL EMAIL: Use caution before replying, clicking links, and opening attachments.
Closed #446https://urldefense.com/v3/__https:/github.com/openpharma/mmrm/issues/446__;!!A_kSX19cfVk!BAh3MCJqkc43A94EUa38BG0Uw31DL1oA0MVeipjpMKWmaUarG2nYT4n3poTm3gVU_0G5DpW_HHWBfuQGmZ_rEw$ as completed via #450https://urldefense.com/v3/__https:/github.com/openpharma/mmrm/pull/450__;!!A_kSX19cfVk!BAh3MCJqkc43A94EUa38BG0Uw31DL1oA0MVeipjpMKWmaUarG2nYT4n3poTm3gVU_0G5DpW_HHWBfuT3PFDn1Q$.
— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/openpharma/mmrm/issues/446*event-13503872454__;Iw!!A_kSX19cfVk!BAh3MCJqkc43A94EUa38BG0Uw31DL1oA0MVeipjpMKWmaUarG2nYT4n3poTm3gVU_0G5DpW_HHWBfuT8qlarpA$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AFTLDN2UZB22RZ6BDQPH2O3ZMOUXNAVCNFSM6AAAAABJUVRMACVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGUYDGOBXGI2DKNA__;!!A_kSX19cfVk!BAh3MCJqkc43A94EUa38BG0Uw31DL1oA0MVeipjpMKWmaUarG2nYT4n3poTm3gVU_0G5DpW_HHWBfuQPdT1qaA$. You are receiving this because you authored the thread.Message ID: @.***>
Thanks @hqian-lilly , @clarkliming would you like to have a look?
Not sure how this works. Does this fix mean that in the updated mmrm package, we will be able to derive the LSmeans values using emmeans?
Yes the error is fixed. you are able to derive the ls means with emmeans and see update https://github.com/openpharma/mmrm/pull/450/files (there is also a test)
Another question, in SAS proc mixed, there is an option “nobound” for the variance to allow negative variance, is this implemented in mmrm?
I believe this is totally another story, to allow negative variance. The current parameterization does not allow for that.
Also I am not completely follow Liming’s initial comments, since in my model, I did have visit as a fixed effect in the model, and generated a second numeric variable (time) to model the variace. I noticed that the variance matrix results is displayed a little bit differently when using sp_exp as an option, which might contribute to the NA calculating the LSmeans values?
here for spatial covariance structure, I was using "visit" to refer to all the timing variables, that includes the "visit" you used as fixed effect, and also the "numeric variable (time)". The results should be displayed differently because spatial exponential only calculates the distance between each visit (under my terminology) so we only provide the correlation matrix where the distance is 1. This is not related to the bug you mentioned, and this bug is resolved in the latest mmrm package. Please try it out on github version and let me know if everything is working for you!
Thank you again for spotting this issue and feedback!
Summary
When fitting mixed model using spatial covariance, the model fitting appears fine. However, extracting lsmeans estimates with "lsmeans" does not yield all the expected results. Lots of lsmeans and their differences are labelled as not estimable. All these lsmeans and their differences should be estimable.
R session info
OS / Environment