mmrm package is built on
complex structure, it might be hard for new developers to onboard. To
make it easier for new developers to join, this documentation is
mmrm is an R package, and the following sections
describe all files/folders that are contained in this package as well as
data-raw/ folder contains source code to produce
simulated example data sets. Currently it contains
bcva_data.R (and its associated helper file) producing the
bcva_data data set, and the cached results for comparing
mmrm and other implementations.
design/ folder is where design documents, prototype
scripts and SAS code for comparisons are stored. When we have a new idea
for a specific implementations, we can add our design doc including
prototype implementations in an
Rmd file in this
Note that this folder is not part of the actual R package but only
part of the git repository. Different folders contain R scripts and
Rmd files for different topics, for example:
design/SAS/ folder contains programs to run MMRM
models in SAS and the corresponding SAS outputs. The results will be
used for integration tests (see integration tests).
Files in the
inst/ folder will be kept after
installation of the R package.
jss.cslis specifying the Journal of Statistical Software citation style used by
REFERENCES.bibkeeps a list of all referenced literature.
WORDLISTis kept up-to-date for all non-English words, allowing the package to pass a spell-checker.
man/ folder contains all function documentation
roxygen2. Please do not edit any file in this
folder, otherwise you may run into problems.
Since we use
roxygen2 also the
file is automatically generated and usually does not need to be edited
Note that there can be exceptions, e.g. when removing a previously
exported function from the package, in which case a manual deletion of
the corresponding entry might be necessary to unblock
This file lists the user facing changes (new features, bug fixes, etc.) and should be updated during the development and cleaned before each release. It is important for the user experience to understand the changes between the releases.
This folder contains all the source code written in R, just like every other R packages. Please refer to the documentation page for details of the user facing API.
We use the
README.Rmd and knit
this to the corresponding
md file. This file specifies the
landing page on the
pkgdown website and the GitHub
repository and should hence be nice, succinct and clean.
This folder contains simulation scripts and results to compare
mmrm with other software or modifications in
mmrm. Please refer to the
README files in the
subfolders for details.
This folder includes all the source code written in
This file includes the implementations of covariance structures with suitable parameterization, and the calculation of lower triangular part of Cholesky factorization of the covariance matrix.
For more about the implementations and why Cholesky factorization is needed, see the model fitting algorithm vignette.
For more about covariance structures, see the covariance structures vignette.
This file contains classes to enable automatic differentiation calculation which are important for the coefficient covariance matrix calculations and Kenward-Roger and Satterthwaite degrees of freedom calculations.
This file contains the
Rcpp interfaces to the
coefficient covariance matrix, Kenward-Roger, Jacobian and prediction
This file implements the Jacobian calculations which are needed for the Satterthwaite degrees of freedom.
This file implements the
R matrix calculations which are needed for the
Kenward-Roger degrees of freedom.
This file specifies additional flags used in the source code
compilation. We specify here the use of
C++14 such that
std::make_unique() is available. Also we ask
TMB to use the
TMB automatic differentiation
framework (instead of the default
CppAD framework) to be
more efficient, and disable useless warnings from the
Note that additional flags such as
-Wno-ignored-attributes cannot be included here because
they are compiler specific. These can instead be specified in local
This file is the core part where the likelihood is calculated. The objective function reads input from R and performs the calculations inside.
Files starting with
test- are tests or helper files to
run tests. (It is important to also aim for high unit test coverage of
the source code.)
tests/ folder includes all the unit tests for the R
functions, using the
vignettes/ folder includes
documentation files to helps the user understand more about the usage,
detail, etc. These vignettes are rendered into
which are deployed on the package website.
There are other files that can be helpful in package development and
are used in
This file is the configuration file for our
pkgdown is used to
covert our package documentation (
vignettes/) into our package website.
For more, visit pkgdown documentation.
This file serves as configuration for
lintr to do the
static code analysis. Please install
lintr package in your
developing system to enable the analysis. It will provide you
information about errors, style issues, etc.
For more, visit lintr documentation.
This file includes the configurations that we use for
pre-commit is a tool that help us
identify simple issues before we submit our code. For more, visit pre-commit documentation.
This file specifies which files and folders in the repository should not be included when building the R package.
Please note that it is important to know that these are regular
expressions. Hence, when we want to specify an exact file name we need
to use e.g. the
^cache$ format, just using
cache instead could match additional files or folders with
cache being part of the name. This can lead to