Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
linters: linters_with_defaults(
line_length_linter = line_length_linter(120),
cyclocomp_linter = NULL,
object_usage_linter = NULL,
commented_code_linter = NULL,
object_name_linter = NULL
Expand Down
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Title: Matching Adjusted Indirect Comparison
Package: maicplus
Version: 0.1.2
Date: 2024-10-29
Authors@R: c(
person(
given = "Gregory",
Expand Down Expand Up @@ -75,5 +74,5 @@ Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2.9000
RoxygenNote: 7.3.2
Config/testthat/edition: 3
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# maicplus 0.1.2

- Changed the link function to binomial for RD and RR in binary analysis
- Updated vignette to recommend against bootstrap in unanchored analysis with citation
- Fix events percentage to properly incorporate weights in the report table for binary analysis
- Replace quantile function to use matrixStats package instead of desctools package
- Added testing PH assumptions vignette
- Fixed the issues with merging weights using match function

# maicplus 0.1.1

- bug fixes
Expand Down
14 changes: 7 additions & 7 deletions R/maic_anchored.R
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,9 @@ maic_anchored_binary <- function(res,
# ~~~ Analysis table
# : set up proper link
glm_link <- switch(eff_measure,
"RD" = binomial(link = "identity"),
"RR" = binomial(link = "log"),
"OR" = binomial(link = "logit")
"RD" = "identity",
"RR" = "log",
"OR" = "logit"
)
res_template <- list(
est = NA,
Expand All @@ -498,9 +498,9 @@ maic_anchored_binary <- function(res,
)

# : fit glm for binary outcome and robust estimate with weights
binobj_ipd <- glm(RESPONSE ~ ARM, ipd, family = glm_link)
binobj_ipd_adj <- suppressWarnings(glm(RESPONSE ~ ARM, ipd, weights = weights, family = glm_link))
binobj_agd <- glm(RESPONSE ~ ARM, pseudo_ipd, family = glm_link)
binobj_ipd <- glm(RESPONSE ~ ARM, ipd, family = binomial(link = glm_link))
binobj_ipd_adj <- suppressWarnings(glm(RESPONSE ~ ARM, ipd, weights = weights, family = binomial(link = glm_link)))
binobj_agd <- glm(RESPONSE ~ ARM, pseudo_ipd, family = binomial(link = glm_link))

bin_robust_cov <- sandwich::vcovHC(binobj_ipd_adj, type = binary_robust_cov_type)
bin_robust_coef <- lmtest::coeftest(binobj_ipd_adj, vcov. = bin_robust_cov)
Expand Down Expand Up @@ -571,7 +571,7 @@ maic_anchored_binary <- function(res,
}

boot_binobj_dat_adj <- suppressWarnings(
glm(RESPONSE ~ ARM, boot_ipd, weights = boot_ipd$weights, family = glm_link)
glm(RESPONSE ~ ARM, boot_ipd, weights = boot_ipd$weights, family = binomial(link = glm_link))
)
boot_AC_est <- coef(boot_binobj_dat_adj)[2]
boot_AC_var <- vcov(boot_binobj_dat_adj)[2, 2]
Expand Down
14 changes: 8 additions & 6 deletions R/maic_unanchored.R
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ maic_unanchored_binary <- function(res,
# ~~~ Analysis table
# : set up proper link
glm_link <- switch(eff_measure,
"RD" = binomial(link = "identity"),
"RR" = binomial(link = "log"),
"OR" = binomial(link = "logit")
"RD" = "identity",
"RR" = "log",
"OR" = "logit"
)
transform_estimate <- switch(eff_measure,
"RD" = function(x) x * 100,
Expand All @@ -366,8 +366,8 @@ maic_unanchored_binary <- function(res,
)

# : fit glm for binary outcome and robust estimate with weights
binobj_dat <- glm(RESPONSE ~ ARM, dat, family = glm_link)
binobj_dat_adj <- suppressWarnings(glm(RESPONSE ~ ARM, dat, weights = weights, family = glm_link))
binobj_dat <- glm(RESPONSE ~ ARM, dat, family = binomial(link = glm_link))
binobj_dat_adj <- suppressWarnings(glm(RESPONSE ~ ARM, dat, weights = weights, family = binomial(link = glm_link)))

bin_robust_cov <- sandwich::vcovHC(binobj_dat_adj, type = binary_robust_cov_type)
bin_robust_coef <- lmtest::coeftest(binobj_dat_adj, vcov. = bin_robust_cov)
Expand Down Expand Up @@ -424,7 +424,9 @@ maic_unanchored_binary <- function(res,
}
boot_dat <- rbind(boot_ipd, pseudo_ipd)
boot_dat$ARM <- factor(boot_dat$ARM, levels = c(trt_agd, trt_ipd))
boot_binobj_dat_adj <- suppressWarnings(glm(RESPONSE ~ ARM, boot_dat, weights = weights, family = glm_link))
boot_binobj_dat_adj <- suppressWarnings(
glm(RESPONSE ~ ARM, boot_dat, weights = weights, family = binomial(link = glm_link))
)
c(est = coef(boot_binobj_dat_adj)[2], var = vcov(boot_binobj_dat_adj)[2, 2])
}

Expand Down
2 changes: 1 addition & 1 deletion R/matching.R
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ plot_weights_ggplot <- function(weighted_data, bin_col, vline_col,
ggplot2::ylab("Frequency") +
ggplot2::xlab("Weight")

return(hist_plot)
hist_plot
}


Expand Down
53 changes: 4 additions & 49 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -1,106 +1,61 @@
ADaM
Ades
adrs
adsl
ADTTE
adtte
AGD
AgD
agd
agg
al
Antoniou
Azocar
Belleli
binarize
bootswatch
Bucher
bucher
Chrysostomos
Comparator
comparator
confounders
csv
diagplot
desctools
doi
DSU
dummize
dummized
ECOG
ESS
et
ffffff
frac
funder
GBB
ggplot
github
glm
Gravestock
Guyot
Hoffmann
href
HTA
hta
https
initializer
io
IPD
ipd
JCC
jval
Kalyvas
Kaplan
kaplan
kmplot
lch
LFF
Liu
MAIC
maic
maicplus
medSurv
meier
MGG
Miranta
matrixStats
MSD
multivariable
navbar
optim
Paramater
ph
pharma
Phillippo
phillippo
png
Pre
pre
preprocessed
Remiro
reproducibility
rmean
rr
Schoenfeld
schoenfeld
sd
Seo
Signorovitch
signorovitch
src
ss
survfit
Texp
THER
TSD
TTE
tte
twt
Unanchored
unanchored
Univariable
unscaled
unstacked
USUBJID
vcovHC
Welton
ww
XXXX
yy
40 changes: 24 additions & 16 deletions tests/testthat/_snaps/maic_anchored.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@
Output
$model_before_ipd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = ipd)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = ipd)

Coefficients:
(Intercept) ARMA
Expand All @@ -426,8 +427,8 @@

$model_after_ipd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = ipd,
weights = weights)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = ipd, weights = weights)

Coefficients:
(Intercept) ARMA
Expand All @@ -439,7 +440,8 @@

$model_agd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = pseudo_ipd)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = pseudo_ipd)

Coefficients:
(Intercept) ARMB
Expand Down Expand Up @@ -553,7 +555,8 @@
Output
$model_before_ipd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = ipd)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = ipd)

Coefficients:
(Intercept) ARMA
Expand All @@ -565,8 +568,8 @@

$model_after_ipd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = ipd,
weights = weights)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = ipd, weights = weights)

Coefficients:
(Intercept) ARMA
Expand All @@ -578,7 +581,8 @@

$model_agd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = pseudo_ipd)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = pseudo_ipd)

Coefficients:
(Intercept) ARMB
Expand Down Expand Up @@ -692,7 +696,8 @@
Output
$model_before_ipd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = ipd)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = ipd)

Coefficients:
(Intercept) ARMA
Expand All @@ -704,8 +709,8 @@

$model_after_ipd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = ipd,
weights = weights)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = ipd, weights = weights)

Coefficients:
(Intercept) ARMA
Expand All @@ -717,7 +722,8 @@

$model_agd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = pseudo_ipd)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = pseudo_ipd)

Coefficients:
(Intercept) ARMB
Expand Down Expand Up @@ -831,7 +837,8 @@
Output
$model_before_ipd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = ipd)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = ipd)

Coefficients:
(Intercept) ARMA
Expand All @@ -843,8 +850,8 @@

$model_after_ipd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = ipd,
weights = weights)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = ipd, weights = weights)

Coefficients:
(Intercept) ARMA
Expand All @@ -856,7 +863,8 @@

$model_agd

Call: glm(formula = RESPONSE ~ ARM, family = glm_link, data = pseudo_ipd)
Call: glm(formula = RESPONSE ~ ARM, family = binomial(link = glm_link),
data = pseudo_ipd)

Coefficients:
(Intercept) ARMB
Expand Down
Loading