From 97b54f9f7a4707a20551be560cf69c4ac662ab3f Mon Sep 17 00:00:00 2001 From: Craig Gower-Page Date: Wed, 2 Mar 2022 16:44:07 +0000 Subject: [PATCH] fixed spelling, fix url --- .Rbuildignore | 1 + .vscode/tasks.json | 21 ++++++++++++++ DESCRIPTION | 2 +- vignettes/advanced.html | 59 ++++++++++++++++++++++----------------- vignettes/quickstart.html | 53 ++++++++++++++++++++++++----------- vignettes/references.bib | 2 +- vignettes/stat_specs.html | 2 +- 7 files changed, 95 insertions(+), 45 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.Rbuildignore b/.Rbuildignore index 940803e6..4d51b6a2 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -16,3 +16,4 @@ ^CRAN-SUBMISSION$ ^cran-comments\.md$ +^.vscode$ \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..41b618b8 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,21 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Build Vignettes", + "type": "shell", + "command": "Rscript vignettes/build.R", + "problemMatcher": {}, + "presentation": { + "echo": true, + "reveal": "always", + "focus": true, + "panel": "dedicated", + "showReuseMessage": true, + "clear": true + } + } + ] +} \ No newline at end of file diff --git a/DESCRIPTION b/DESCRIPTION index d7db4e6d..a3e8a7b9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,7 +7,7 @@ Authors@R: c( person("Marcel", "Wolbers", email = "marcel.wolbers@roche.com", role = "ctb"), person("Roche", role = c("cph", "fnd")) ) -Description: Implements reference based multiple imputation allowing for the imputation of longitudinal datasets using pre-defined strategies. +Description: Implements reference based multiple imputation allowing for the imputation of longitudinal datasets using predefined strategies. Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) diff --git a/vignettes/advanced.html b/vignettes/advanced.html index e9c3e9c4..4ba5744b 100644 --- a/vignettes/advanced.html +++ b/vignettes/advanced.html @@ -462,31 +462,38 @@

2 Data simulation using function ) head(data) -#> id visit group outcome_bl outcome_noICE ind_ice1 ind_ice2 dropout_ice1 outcome -#> 1 id_1 0 Control 57.32704 57.32704 0 0 0 57.32704 -#> 2 id_1 1 Control 57.32704 54.69751 1 0 1 NA -#> 3 id_1 2 Control 57.32704 58.60702 1 0 1 NA -#> 4 id_1 3 Control 57.32704 61.50119 1 0 1 NA -#> 5 id_1 4 Control 57.32704 56.68363 1 0 1 NA -#> 6 id_1 5 Control 57.32704 66.14799 1 0 1 NA - -# As a simple descriptive of the simulated data, summarize the number of subjects with ICEs and missing data -data %>% - group_by(id) %>% - summarise( - group = group[1], - any_ICE = (any(ind_ice1 == 1)), - any_NA = any(is.na(outcome))) %>% - group_by(group) %>% - summarise( - subjects_with_ICE = sum(any_ICE), - subjects_with_missings = sum(any_NA) - ) -#> # A tibble: 2 × 3 -#> group subjects_with_ICE subjects_with_missings -#> <fct> <int> <int> -#> 1 Control 18 8 -#> 2 Intervention 25 14 +#> id visit group outcome_bl outcome_noICE ind_ice1 ind_ice2 dropout_ice1 +#> 1 id_1 0 Control 57.32704 57.32704 0 0 0 +#> 2 id_1 1 Control 57.32704 54.69751 1 0 1 +#> 3 id_1 2 Control 57.32704 58.60702 1 0 1 +#> 4 id_1 3 Control 57.32704 61.50119 1 0 1 +#> 5 id_1 4 Control 57.32704 56.68363 1 0 1 +#> 6 id_1 5 Control 57.32704 66.14799 1 0 1 +#> outcome +#> 1 57.32704 +#> 2 NA +#> 3 NA +#> 4 NA +#> 5 NA +#> 6 NA + +# As a simple descriptive of the simulated data, summarize the number of subjects with ICEs and missing data +data %>% + group_by(id) %>% + summarise( + group = group[1], + any_ICE = (any(ind_ice1 == 1)), + any_NA = any(is.na(outcome))) %>% + group_by(group) %>% + summarise( + subjects_with_ICE = sum(any_ICE), + subjects_with_missings = sum(any_NA) + ) +#> # A tibble: 2 × 3 +#> group subjects_with_ICE subjects_with_missings +#> <fct> <int> <int> +#> 1 Control 18 8 +#> 2 Intervention 25 14

3 Handling of observed post-ICE data in rbmi under reference-based imputation

@@ -779,7 +786,7 @@

6 Custom imputation strategies#> pars <- list(mu = mu, sigma = sigma) #> return(pars) #> } -#> <bytecode: 0x7fe91cf7a468> +#> <bytecode: 0x7f8093c266c8> #> <environment: namespace:rbmi>

To further illustrate this for a simple example, assume that a new strategy is to be implemented as follows: - The marginal mean of the imputation distribution is equal to the marginal mean trajectory for the subject according to their assigned group and covariates up to the ICE. diff --git a/vignettes/quickstart.html b/vignettes/quickstart.html index c3a8393f..5e1b8871 100644 --- a/vignettes/quickstart.html +++ b/vignettes/quickstart.html @@ -362,9 +362,17 @@

2 The Data

We use a publicly available example dataset from an antidepressant clinical trial of an active drug versus placebo. The relevant endpoint is the Hamilton 17-item depression rating scale (HAMD17) which was assessed at baseline and at weeks 1, 2, 4, and 6. Study drug discontinuation occurred in 24% of subjects from the active drug and 26% of subjects from placebo. All data after study drug discontinuation are missing and there is a single additional intermittent missing observation.

library(rbmi)
 library(dplyr)
-
-data("antidepressant_data")
-dat <- antidepressant_data
+#> +#> Attaching package: 'dplyr' +#> The following objects are masked from 'package:stats': +#> +#> filter, lag +#> The following objects are masked from 'package:base': +#> +#> intersect, setdiff, setequal, union + +data("antidepressant_data") +dat <- antidepressant_data

We consider an imputation model with the mean change from baseline in the HAMD17 score as the outcome (variable CHANGE in the dataset). The following covariates are included in the imputation model: the treatment group (THERAPY), the (categorical) visit (VISIT), treatment-by-visit interactions, the baseline HAMD17 score (BASVAL), and baseline HAMD17 score-by-visit interactions. A common unstructured covariance matrix structure is assumed for both groups. The analysis model is an ANCOVA model with the treatment group as the primary covariate and adjustment for the baseline HAMD17 score.

rbmi expects its input dataset to be complete; that is, there must be one row per subject for each visit. Missing outcome values should be coded as NA, while missing covariate values are not allowed. If the dataset is incomplete, then the expand_locf() helper function can be used to add any missing rows, using LOCF imputation to carry forward the observed baseline covariate values to visits with missing outcomes. Rows corresponding to missing outcomes are not present in the antidepressant trial dataset. To address this we will therefore use the expand_locf() function as follows:


@@ -517,19 +525,32 @@ 

4 Impute

object using the extract_imputed_dfs() helper function, i.e.:

imputed_dfs <- extract_imputed_dfs(imputeObj)
 head(imputed_dfs[[10]], 12) # first 12 rows of 10th imputed dataset
-#>     PATIENT HAMATOTL PGIIMP RELDAYS VISIT THERAPY GENDER POOLINV BASVAL HAMDTL17 CHANGE
-#> 1  new_pt_1       21      2       7     4    DRUG      F     006     32       21    -11
-#> 2  new_pt_1       19      2      14     5    DRUG      F     006     32       20    -12
-#> 3  new_pt_1       21      3      28     6    DRUG      F     006     32       19    -13
-#> 4  new_pt_1       17      4      42     7    DRUG      F     006     32       17    -15
-#> 5  new_pt_2       18      3       7     4 PLACEBO      F     006     14       11     -3
-#> 6  new_pt_2       18      2      15     5 PLACEBO      F     006     14       14      0
-#> 7  new_pt_2       14      3      29     6 PLACEBO      F     006     14        9     -5
-#> 8  new_pt_2        8      2      42     7 PLACEBO      F     006     14        5     -9
-#> 9  new_pt_3       18      3       7     4    DRUG      F     006     21       20     -1
-#> 10 new_pt_3       17      3      14     5    DRUG      F     006     21       18     -3
-#> 11 new_pt_3       12      3      28     6    DRUG      F     006     21       16     -5
-#> 12 new_pt_3        9      3      44     7    DRUG      F     006     21       13     -8
+#> PATIENT HAMATOTL PGIIMP RELDAYS VISIT THERAPY GENDER POOLINV BASVAL +#> 1 new_pt_1 21 2 7 4 DRUG F 006 32 +#> 2 new_pt_1 19 2 14 5 DRUG F 006 32 +#> 3 new_pt_1 21 3 28 6 DRUG F 006 32 +#> 4 new_pt_1 17 4 42 7 DRUG F 006 32 +#> 5 new_pt_2 18 3 7 4 PLACEBO F 006 14 +#> 6 new_pt_2 18 2 15 5 PLACEBO F 006 14 +#> 7 new_pt_2 14 3 29 6 PLACEBO F 006 14 +#> 8 new_pt_2 8 2 42 7 PLACEBO F 006 14 +#> 9 new_pt_3 18 3 7 4 DRUG F 006 21 +#> 10 new_pt_3 17 3 14 5 DRUG F 006 21 +#> 11 new_pt_3 12 3 28 6 DRUG F 006 21 +#> 12 new_pt_3 9 3 44 7 DRUG F 006 21 +#> HAMDTL17 CHANGE +#> 1 21 -11 +#> 2 20 -12 +#> 3 19 -13 +#> 4 17 -15 +#> 5 11 -3 +#> 6 14 0 +#> 7 9 -5 +#> 8 5 -9 +#> 9 20 -1 +#> 10 18 -3 +#> 11 16 -5 +#> 12 13 -8

Note that in the case of method_bayes() or method_approxbayes(), all imputed datasets correspond to random imputations on the original dataset. For method_condmean(), the first imputed dataset will always correspond to the completed original dataset containing all subjects. For method_condmean(type="jackknife"), the remaining datasets correspond to conditional mean imputations on leave-one-subject-out datasets, diff --git a/vignettes/references.bib b/vignettes/references.bib index 101c9712..fa373e8b 100644 --- a/vignettes/references.bib +++ b/vignettes/references.bib @@ -332,7 +332,7 @@ @Misc{Rstan author = {{Stan Development Team}}, note = {R package version 2.21.2}, year = {2020}, - url = {http://mc-stan.org/} + url = {https://mc-stan.org/} } @article{Seaman2014, diff --git a/vignettes/stat_specs.html b/vignettes/stat_specs.html index b14afa69..45778301 100644 --- a/vignettes/stat_specs.html +++ b/vignettes/stat_specs.html @@ -819,7 +819,7 @@

References

Seaman, Shaun R, Ian R White, and Finbarr P Leacy. 2014. “Comment on Analysis of Longitudinal Trials with Protocol Deviations: A Framework for Relevant, Accessible Assumptions, and Inference via Multiple Imputation,’ by Carpenter, Roger, and Kenward.” Journal of Biopharmaceutical Statistics 24 (6): 1358–62.
-Stan Development Team. 2020. RStan: The R Interface to Stan.” http://mc-stan.org/. +Stan Development Team. 2020. RStan: The R Interface to Stan.” https://mc-stan.org/.
Tang, Yongqiang. 2017. “On the Multiple Imputation Variance Estimator for Control-Based and Delta-Adjusted Pattern Mixture Models.” Biometrics 73 (4): 1379–87.