openpharma / mmrm

Mixed Models for Repeated Measures (MMRM) in R.
https://openpharma.github.io/mmrm/
Other
101 stars 17 forks source link

fix anova error #427

Closed clarkliming closed 4 months ago

clarkliming commented 4 months ago

close #426

previously all covariate are treated as factor. Now there is a additional check for anova, to provide length of unique character values, instead of the nlevels functions to count the levels.

In addition, the data used, is not component(obj, "full_frame") (which may contain character variable) now. it is using model.frame(obj) to ensure everything is a factor.

The reason is that in most of our analysis we want to ensure that factors are used, to avoid potential issues (like difference in orders of factor that could lead to incorrect predict etc)

github-actions[bot] commented 4 months ago

badge

Code Coverage Summary

Filename                    Stmts    Miss  Cover    Missing
------------------------  -------  ------  -------  ----------------------------
R/between-within.R             59       0  100.00%
R/component.R                  67       0  100.00%
R/cov_struct.R                 97       1  98.97%   407
R/empirical.R                   7       0  100.00%
R/fit.R                       229       3  98.69%   420, 481, 511
R/interop-car.R                72       3  95.83%   9, 48, 68
R/interop-emmeans.R            39       0  100.00%
R/interop-parsnip.R            59       1  98.31%   12
R/kenwardroger.R               92       2  97.83%   41, 63
R/mmrm-methods.R              140       0  100.00%
R/residual.R                    8       8  0.00%    10-31
R/satterthwaite.R             116      12  89.66%   238-249
R/skipping.R                    8       0  100.00%
R/testing.R                    64       4  93.75%   29, 31, 80, 82
R/tidiers.R                    72       2  97.22%   46-47
R/tmb-methods.R               288       3  98.96%   277-278, 338
R/tmb.R                       281       0  100.00%
R/utils-formula.R              27       0  100.00%
R/utils-nse.R                  16       0  100.00%
R/utils.R                     185      12  93.51%   277-287, 457, 486
R/zzz.R                        70      24  65.71%   7-22, 55-60, 90, 118, 138
src/chol_cache.h               63       0  100.00%
src/covariance.h              101       1  99.01%   177
src/derivatives.h             126       0  100.00%
src/empirical.cpp              72       0  100.00%
src/exports.cpp                47       0  100.00%
src/jacobian.cpp               47       1  97.87%   54
src/kr_comp.cpp                56       0  100.00%
src/mmrm.cpp                   76       0  100.00%
src/predict.cpp                93       0  100.00%
src/test-chol_cache.cpp        58       5  91.38%   9, 18, 26, 55, 62
src/test-covariance.cpp       123       5  95.93%   9, 29, 40, 61, 72
src/test-derivatives.cpp      108       7  93.52%   44, 53, 62, 85, 94, 106, 124
src/test-utils.cpp            195       7  96.41%   9, 16, 24, 34, 44, 57, 119
src/testthat-helpers.h         15       5  66.67%   36-37, 41, 50, 53
src/utils.h                    84       0  100.00%
TOTAL                        3260     106  96.75%

Diff against main

Filename           Stmts    Miss  Cover
---------------  -------  ------  -------
R/interop-car.R       +2      +1  -1.31%
TOTAL                 +2      +1  -0.03%

Results for commit: a264bef2be6f8bc0fb7dde89ea561956337a56fc

Minimum allowed coverage is 80%

:recycle: This comment has been updated with latest results

github-actions[bot] commented 4 months ago

Unit Tests Summary

    1 files     45 suites   24s :stopwatch:   491 tests   453 :white_check_mark: 38 :zzz: 0 :x: 1 885 runs  1 843 :white_check_mark: 42 :zzz: 0 :x:

Results for commit a264bef2.

github-actions[bot] commented 4 months ago

Unit Test Performance Difference

Additional test case details | Test Suite | $Status$ | Time on `main` | $±Time$ | Test Case | |:-----|:----:|:----:|:----:|:-----| | car | 👶 | | $+0.14$ | Anova_works_if_covariate_are_character |

Results for commit b26629827a158d56198491441983d06ca4c307ce

♻️ This comment has been updated with latest results.