Cannot extract residuals of mmrm model
Closed this issue · 2 comments
Summary
Hello, I tried to run the code from your introduction and cannot extract residuals. When running following code, reisudals_resp is NULL. Other types of residuals as suggested by your introduction (pearson or normalized) also produces NULL. Can you give me some advice how to extract residuals?
fit <- mmrm(
formula = FEV1 ~ RACE + ARMCD * AVISIT + us(AVISIT | USUBJID),
data = fev_data
)
residuals_resp <-residuals(fit, type = "response")
R session info
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=Polish_Poland.1250 LC_CTYPE=Polish_Poland.1250 LC_MONETARY=Polish_Poland.1250 LC_NUMERIC=C
[5] LC_TIME=Polish_Poland.1250
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mmrm_0.2.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.10 rstudioapi_0.14 TMB_1.9.4 magrittr_2.0.3 MASS_7.3-60 splines_4.1.3
[7] xtable_1.8-4 lattice_0.21-8 rlang_1.1.0 multcomp_1.4-23 stringr_1.5.0 tools_4.1.3
[13] rbibutils_2.2.13 parallel_4.1.3 grid_4.1.3 checkmate_2.2.0 nlme_3.1-162 TH.data_1.1-2
[19] cli_3.6.1 coda_0.19-4 emmeans_1.8.6 survival_3.5-5 lifecycle_1.0.3 numDeriv_2016.8-1.1
[25] Matrix_1.5-4 codetools_0.2-19 Rdpack_2.4 glue_1.6.2 sandwich_3.0-2 stringi_1.7.12
[31] estimability_1.4.1 compiler_4.1.3 backports_1.4.1 mvtnorm_1.1-3 zoo_1.8-12
# R -e "utils::sessionInfo()" output goes here
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=Polish_Poland.1250 LC_CTYPE=Polish_Poland.1250 LC_MONETARY=Polish_Poland.1250 LC_NUMERIC=C
[5] LC_TIME=Polish_Poland.1250
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mmrm_0.2.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.10 rstudioapi_0.14 TMB_1.9.4 magrittr_2.0.3 MASS_7.3-60 splines_4.1.3
[7] xtable_1.8-4 lattice_0.21-8 rlang_1.1.0 multcomp_1.4-23 stringr_1.5.0 tools_4.1.3
[13] rbibutils_2.2.13 parallel_4.1.3 grid_4.1.3 checkmate_2.2.0 nlme_3.1-162 TH.data_1.1-2
[19] cli_3.6.1 coda_0.19-4 emmeans_1.8.6 survival_3.5-5 lifecycle_1.0.3 numDeriv_2016.8-1.1
[25] Matrix_1.5-4 codetools_0.2-19 Rdpack_2.4 glue_1.6.2 sandwich_3.0-2 stringi_1.7.12
[31] estimability_1.4.1 compiler_4.1.3 backports_1.4.1 mvtnorm_1.1-3 zoo_1.8-12
OS / Environment
- OS: Windows 10
We have tried to run this code also in Linux (Ubuntu 22.04) and effect is the same.
Hi @Misiura7 ,
The residuals method is not yet in the CRAN release. You can install the GitHub version of the package and then it will work.
Cheers
Daniel
Thank you Daniel! Now it is working perfectly.