Skip to content

Commit

Permalink
should have fixed R checks
Browse files Browse the repository at this point in the history
  • Loading branch information
n8thangreen committed Sep 2, 2024
1 parent 9c01a0c commit 7580fdb
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Authors@R: c(
comment = c(ORCID = "0000-0002-7263-4251")))
Description:
Model-based standardisation with several different computation approaches.
See Remiro‐Azócar A, Heath A, Baio G (2022). Parametric G‐computation for compatible
indirect treatment comparisons with limited individual patient data.
See Remiro‐Azócar A, Heath A, Baio G (2022. Parametric G‐computation for compatible
indirect treatment comparisons with limited individual patient data,
Res. Synth. Methods, 1–31. ISSN 1759-2879, <doi:10.1002/jrsm.1565, 2108.12208>.
License: GPL (>= 3)
Encoding: UTF-8
Expand All @@ -22,6 +22,7 @@ RoxygenNote: 7.3.2
Imports:
boot,
copula,
MASS,
rstanarm,
Rdpack (>= 0.7)
Suggests:
Expand All @@ -31,7 +32,6 @@ Suggests:
gridExtra,
here,
knitr,
MASS,
parallel,
purrr,
rmarkdown,
Expand Down
18 changes: 11 additions & 7 deletions R/gen_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#'
#' @examples
#'
#' \dontrun{
#' x <- gen_data(
#' N = 100,
#' b_trt = log(0.17),
Expand All @@ -31,16 +32,18 @@
#' allocation = 2/3)
#'
#' head(x)
#'
#' }
gen_data <- function(N, b_trt, b_X, b_EM, b_0,
meanX, sdX, event_rate,
corX, allocation) {
# 4 baseline covariates
rho <- matrix(corX, nrow=4, ncol=4) # set correlation matrix
diag(rho) <- rep(1, 4)
n_c <- 4

rho <- matrix(corX, nrow=n_c, ncol=n_c) # set correlation matrix
diag(rho) <- rep(1, n_c)
N_active <- round(N*allocation) # number of patients under active treatment
N_control <- N - N_active # number of patients under control
sd.vec <- rep(sdX, 4) # vector of standard deviations
sd.vec <- rep(sdX, n_c) # vector of standard deviations

cov.mat <- cor2cov(rho, sd.vec) # covariance matrix

Expand All @@ -49,21 +52,22 @@ gen_data <- function(N, b_trt, b_X, b_EM, b_0,
X_active <-
as.data.frame(
MASS::mvrnorm(n = N_active,
mu = rep(meanX, 4),
mu = rep(meanX, n_c),
Sigma = cov.mat))

# patients under control treatment
X_control <-
as.data.frame(
MASS::mvrnorm(n = N_control,
mu = rep(meanX, 4),
mu = rep(meanX, n_c),
Sigma = cov.mat))
# all patients
X <- rbind(X_active, X_control)
colnames(X) <- c("X1", "X2", "X3", "X4")

# treatment assignment (1: active; 0: control)
trt <- c(rep(1,N_active), rep(0,N_control))
trt <- c(rep(1, N_active),
rep(0, N_control))

# generate binary outcomes using logistic regression
# linear predictor
Expand Down
22 changes: 12 additions & 10 deletions R/print.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@

#' @export
print.outstandR <- function(x, newline = TRUE) {

cat("\nContrasts:", x$contrasts, "\n")
cat("\nVariances:", x$contrasts_variances, "\n")
cat("\nConfidence intervals:", x$contrasts_ci, "\n")

if (newline) {
cat("\n")
}

invisible(x)
x

#TODO:
# cat("\nContrasts:", x$contrasts, "\n")
# cat("\nVariances:", x$contrasts_variances, "\n")
# cat("\nConfidence intervals:", x$contrasts_ci, "\n")
#
# if (newline) {
# cat("\n")
# }
#
# invisible(x)
}
1 change: 0 additions & 1 deletion R/strategy_.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#' \eqn{t} is equal to the odds of being enrolled in the _AC_ trial vs the _AB_ trial.
#'
#' @param R The number of resamples used for the non-parametric bootstrap
#' @template args-ald
#' @return `maic` class object
#'
#' @importFrom utils modifyList
Expand Down
2 changes: 1 addition & 1 deletion outstandR.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ LaTeX: pdfLaTeX
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace,vignette
PackageRoxygenize: rd,collate,namespace

0 comments on commit 7580fdb

Please sign in to comment.