diff --git a/DESCRIPTION b/DESCRIPTION index 1b6cac16..59d06623 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -40,4 +40,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1.9000 +RoxygenNote: 7.3.2 diff --git a/R/data.R b/R/data.R index 0990ef58..e3155148 100644 --- a/R/data.R +++ b/R/data.R @@ -208,6 +208,40 @@ #' @family anchored datasets "centered_ipd_twt" +#' Weighted object for two arm trial data +#' @format A `maicplus_estimate_weights` object created by [estimate_weights()] containing +#' \describe{ +#' \item{data}{patient level data with weights} +#' \item{centered_colnames}{Columns used in MAIC} +#' \item{nr_missing}{Number of observations with missing data} +#' \item{ess}{Expected sample size} +#' \item{opt}{Information from `optim` from weight calculation} +#' \item{boot}{Parameters and bootstrap sample weights for the 100 samples} +#' } +#' @description +#' The weighted patient data for a two arm trial generated from the centered patient data ([centered_ipd_twt]). +#' It has weights calculated for 100 bootstrap samples. +#' +#' The object is generated using the following code: +#' ``` +#' estimate_weights( +#' data = centered_ipd_twt, +#' centered_colnames = c( +#' "AGE_CENTERED", +#' "AGE_MEDIAN_CENTERED", +#' "AGE_SQUARED_CENTERED", +#' "SEX_MALE_CENTERED", +#' "ECOG0_CENTERED", +#' "SMOKE_CENTERED" +#' ), +#' n_boot_iteration = 100 +#' ) +#' ``` +#' +#' @keywords dataset +#' @family anchored datasets +"weighted_twt" + if (FALSE) { make_roxygen_data <- function(df) { diff --git a/R/plot_km2.R b/R/plot_km2.R index b6fb6617..c178b632 100644 --- a/R/plot_km2.R +++ b/R/plot_km2.R @@ -198,7 +198,7 @@ basic_kmplot2 <- function(kmlist, ylab = endpoint_name, legend.title = "Treatment", legend = c(0.85, 0.82), - title = paste0(main_title, "\nEndpoint:", endpoint_name), + title = paste0(main_title, "\nEndpoint: ", endpoint_name), legend.labs = kmlist_name, tables.theme = survminer::theme_cleantable(), ggtheme = ggplot2::theme_classic(base_size = 10), diff --git a/data-raw/dummy_anchored.R b/data-raw/dummy_anchored.R index 19fd99ee..61a5f363 100644 --- a/data-raw/dummy_anchored.R +++ b/data-raw/dummy_anchored.R @@ -73,8 +73,11 @@ agd <- process_agd(agd) adsl_twt <- dummize_ipd(adsl_twt, dummize_cols = c("SEX"), dummize_ref_level = c("Female")) centered_ipd_twt <- center_ipd(ipd = adsl_twt, agd = agd) +centered_colnames <- paste0(c("AGE", "AGE_MEDIAN", "AGE_SQUARED", "SEX_MALE", "ECOG0", "SMOKE"), "_CENTERED") +weighted_twt <- estimate_weights(data = centered_ipd_twt, centered_colnames = centered_colnames, n_boot_iteration = 100) + ### Output -usethis::use_data(adsl_twt, adtte_twt, pseudo_ipd_twt, centered_ipd_twt, adrs_twt, +usethis::use_data(adsl_twt, adtte_twt, pseudo_ipd_twt, centered_ipd_twt, adrs_twt, weighted_twt, internal = FALSE, overwrite = TRUE ) diff --git a/data/adrs_twt.rda b/data/adrs_twt.rda index b202158b..1447cd44 100644 Binary files a/data/adrs_twt.rda and b/data/adrs_twt.rda differ diff --git a/data/adsl_twt.rda b/data/adsl_twt.rda index 7d9c10c4..8e417f71 100644 Binary files a/data/adsl_twt.rda and b/data/adsl_twt.rda differ diff --git a/data/adtte_twt.rda b/data/adtte_twt.rda index 35da640e..9da21f87 100644 Binary files a/data/adtte_twt.rda and b/data/adtte_twt.rda differ diff --git a/data/centered_ipd_twt.rda b/data/centered_ipd_twt.rda index 8d04e22e..aacbc899 100644 Binary files a/data/centered_ipd_twt.rda and b/data/centered_ipd_twt.rda differ diff --git a/data/pseudo_ipd_twt.rda b/data/pseudo_ipd_twt.rda index 758778bf..f7bf9f67 100644 Binary files a/data/pseudo_ipd_twt.rda and b/data/pseudo_ipd_twt.rda differ diff --git a/data/weighted_twt.rda b/data/weighted_twt.rda new file mode 100644 index 00000000..6299f26d Binary files /dev/null and b/data/weighted_twt.rda differ diff --git a/man/adsl_twt.Rd b/man/adsl_twt.Rd index 6ef07138..d407f498 100644 --- a/man/adsl_twt.Rd +++ b/man/adsl_twt.Rd @@ -28,7 +28,8 @@ Other anchored datasets: \code{\link{adtte_twt}}, \code{\link{agd}}, \code{\link{centered_ipd_twt}}, -\code{\link{pseudo_ipd_twt}} +\code{\link{pseudo_ipd_twt}}, +\code{\link{weighted_twt}} } \concept{anchored datasets} \keyword{dataset} diff --git a/man/adtte_twt.Rd b/man/adtte_twt.Rd index 5e6d2618..d1783840 100644 --- a/man/adtte_twt.Rd +++ b/man/adtte_twt.Rd @@ -29,7 +29,8 @@ Other anchored datasets: \code{\link{adsl_twt}}, \code{\link{agd}}, \code{\link{centered_ipd_twt}}, -\code{\link{pseudo_ipd_twt}} +\code{\link{pseudo_ipd_twt}}, +\code{\link{weighted_twt}} } \concept{anchored datasets} \keyword{dataset} diff --git a/man/agd.Rd b/man/agd.Rd index 31b097e0..58838421 100644 --- a/man/agd.Rd +++ b/man/agd.Rd @@ -38,7 +38,8 @@ Other anchored datasets: \code{\link{adsl_twt}}, \code{\link{adtte_twt}}, \code{\link{centered_ipd_twt}}, -\code{\link{pseudo_ipd_twt}} +\code{\link{pseudo_ipd_twt}}, +\code{\link{weighted_twt}} } \concept{anchored datasets} \concept{unanchored datasets} diff --git a/man/centered_ipd_twt.Rd b/man/centered_ipd_twt.Rd index a34fa20c..dd32faf9 100644 --- a/man/centered_ipd_twt.Rd +++ b/man/centered_ipd_twt.Rd @@ -37,7 +37,8 @@ Other anchored datasets: \code{\link{adsl_twt}}, \code{\link{adtte_twt}}, \code{\link{agd}}, -\code{\link{pseudo_ipd_twt}} +\code{\link{pseudo_ipd_twt}}, +\code{\link{weighted_twt}} } \concept{anchored datasets} \keyword{dataset} diff --git a/man/pseudo_ipd_twt.Rd b/man/pseudo_ipd_twt.Rd index 15a2be3e..19730dc6 100644 --- a/man/pseudo_ipd_twt.Rd +++ b/man/pseudo_ipd_twt.Rd @@ -23,7 +23,8 @@ Other anchored datasets: \code{\link{adsl_twt}}, \code{\link{adtte_twt}}, \code{\link{agd}}, -\code{\link{centered_ipd_twt}} +\code{\link{centered_ipd_twt}}, +\code{\link{weighted_twt}} } \concept{anchored datasets} \keyword{dataset} diff --git a/man/weighted_twt.Rd b/man/weighted_twt.Rd new file mode 100644 index 00000000..07ecc1fb --- /dev/null +++ b/man/weighted_twt.Rd @@ -0,0 +1,50 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{weighted_twt} +\alias{weighted_twt} +\title{Weighted object for two arm trial data} +\format{ +A \code{maicplus_estimate_weights} object created by \code{\link[=estimate_weights]{estimate_weights()}} containing +\describe{ +\item{data}{patient level data with weights} +\item{centered_colnames}{Columns used in MAIC} +\item{nr_missing}{Number of observations with missing data} +\item{ess}{Expected sample size} +\item{opt}{Information from \code{optim} from weight calculation} +\item{boot}{Parameters and bootstrap sample weights for the 100 samples} +} +} +\usage{ +weighted_twt +} +\description{ +The weighted patient data for a two arm trial generated from the centered patient data (\link{centered_ipd_twt}). +It has weights calculated for 100 bootstrap samples. + +The object is generated using the following code: + +\if{html}{\out{
}}\preformatted{estimate_weights( + data = centered_ipd_twt, + centered_colnames = c( + "AGE_CENTERED", + "AGE_MEDIAN_CENTERED", + "AGE_SQUARED_CENTERED", + "SEX_MALE_CENTERED", + "ECOG0_CENTERED", + "SMOKE_CENTERED" + ), + n_boot_iteration = 100 + ) +}\if{html}{\out{
}} +} +\seealso{ +Other anchored datasets: +\code{\link{adsl_twt}}, +\code{\link{adtte_twt}}, +\code{\link{agd}}, +\code{\link{centered_ipd_twt}}, +\code{\link{pseudo_ipd_twt}} +} +\concept{anchored datasets} +\keyword{dataset}