-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
The following code works without the use of the parametric argument, but fails if the parametric argument is being used.
library(bartCause)
# Use package benchtm to generate some clinical trial data set example:
# https://htmlpreview.github.io/?https://raw.githubusercontent.com/Sophie-Sun/benchtm/master/docs/articles/a01_User_guidance.html
if (!require(benchtm))
devtools::install_github("Sophie-Sun/benchtm")
#> Loading required package: benchtm
set.seed(1111)
X <- generate_X_dist(n=1000, p=10, rho=0.5)
trt <- generate_trt(n=nrow(X), p_trt = 0.5)
dat <- generate_y(X, trt, prog = "0.5*((X1=='Y')+X3)",
pred = "X3>0", b0 = 0, b1 = 1,
type = "continuous", sigma_error = 3)
fit <- bartc(response = Y,
treatment = trt,
confounders = .,
parametric = X3,
method.trt = 0.5,
data = dat)
#> fitting response model via method 'bart'
#> Warning: Some predictor variables are on very different scales: consider
#> rescaling
#> Warning in center_x(x, FALSE): Dropped empty interaction levels: ps
#> Error in dimnames(result) <- `*vtmp*`: length of 'dimnames' [1] not equal to array extent
# Session info
sessionInfo()
#> R version 4.3.2 (2023-10-31)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 22.04.1 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: Europe/Dublin
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] benchtm_0.4.0 bartCause_1.0-9
#>
#> loaded via a namespace (and not attached):
#> [1] gtable_0.3.5 xfun_0.46 ggplot2_3.5.1
#> [4] coin_1.4-3 lattice_0.21-9 numDeriv_2016.8-1.1
#> [7] vctrs_0.6.5 tools_4.3.2 generics_0.1.3
#> [10] stats4_4.3.2 parallel_4.3.2 sandwich_3.1-0
#> [13] tibble_3.2.1 proxy_0.4-27 fansi_1.0.6
#> [16] pkgconfig_2.0.3 proto_1.0.0 Matrix_1.6-1.1
#> [19] KernSmooth_2.23-22 party_1.3-14 RcppParallel_5.1.7
#> [22] truncnorm_1.0-9 lifecycle_1.0.4 stringr_1.5.1
#> [25] compiler_4.3.2 munsell_0.5.1 codetools_0.2-19
#> [28] synthpop_1.8-0 strucchange_1.5-3 htmltools_0.5.8.1
#> [31] class_7.3-22 rmutil_1.1.10 Rsolnp_1.16
#> [34] yaml_2.3.9 nloptr_2.0.3 pillar_1.9.0
#> [37] MASS_7.3-60 classInt_0.4-10 boot_1.3-28.1
#> [40] rpart_4.1.21 multcomp_1.4-25 nlme_3.1-163
#> [43] broman_0.80 tidyselect_1.2.1 digest_0.6.36
#> [46] stringi_1.8.4 polspline_1.1.24 mvtnorm_1.2-4
#> [49] dplyr_1.1.4 splines_4.3.2 fastmap_1.2.0
#> [52] mipfp_3.2.1 grid_4.3.2 colorspace_2.1-0
#> [55] cli_3.6.3 magrittr_2.0.3 randomForest_4.7-1.1
#> [58] survival_3.5-7 utf8_1.2.4 TH.data_1.1-2
#> [61] e1071_1.7-14 foreign_0.8-85 libcoin_1.0-10
#> [64] withr_3.0.0 scales_1.3.0 rmarkdown_2.27
#> [67] matrixStats_1.2.0 lme4_1.1-35.1 nnet_7.3-19
#> [70] ranger_0.16.0 zoo_1.8-12 modeltools_0.2-23
#> [73] stan4bart_0.0-10 evaluate_0.24.0 knitr_1.48
#> [76] cmm_1.0 rlang_1.1.4 Rcpp_1.0.13
#> [79] glue_1.7.0 dbarts_0.9-28 reprex_2.1.0
#> [82] minqa_1.2.6 rstudioapi_0.16.0 R6_2.5.1
#> [85] plyr_1.8.9 fs_1.6.4Created on 2024-11-25 with reprex v2.1.0
(btw, the other warning regarding the different scales of the predictors will remain even if X is scaled)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels