Skip to content

Commit

Permalink
bug patch
Browse files Browse the repository at this point in the history
  • Loading branch information
gperrett committed Apr 9, 2024
1 parent ab52feb commit 98d5fcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions thinkCausal/R/fct_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' @param ran.eff if not "None", then the name of the column within .data that represents the random effects
#' @param .estimand the causal estimand. See bartCause::bartc
#' @param .weights name of the variable corresponding to a vector of survey weights
#' @param random a logical TRUE is completely randomized design FALSE otherwise
#' @param rct a logical TRUE is completely randomized design FALSE otherwise
#' @return an object of class "bartcFit"
#' @noRd
fit_bart <- function(.data, .weights, ran_eff, .estimand, random){
Expand All @@ -17,7 +17,7 @@ fit_bart <- function(.data, .weights, ran_eff, .estimand, random){
treatment = .data[, 1],
confounders = clean_confounders_for_bart(.data[, ind:length(.data)]),
estimand = .estimand,
method.trt = ifelse(random, 'none', 'bart'),
method.trt = ifelse(rct, 'none', 'bart'),
seed = 2
)
}
Expand All @@ -30,6 +30,7 @@ fit_bart <- function(.data, .weights, ran_eff, .estimand, random){
estimand = .estimand,
group.by = ran_eff,
use.ranef = TRUE,
method.trt = ifelse(rct, 'none', 'bart'),
seed = 2
)
}
Expand All @@ -45,6 +46,7 @@ fit_bart <- function(.data, .weights, ran_eff, .estimand, random){
confounders = clean_confounders_for_bart(.data[, ind:length(.data)]),
estimand = .estimand,
weights = .data[[.weights]],
method.trt = ifelse(rct, 'none', 'bart'),
seed = 2
)
}
Expand All @@ -58,6 +60,7 @@ fit_bart <- function(.data, .weights, ran_eff, .estimand, random){
weights = .data[[.weights]],
group.by = ran_eff,
use.ranef = TRUE,
method.trt = ifelse(rct, 'none', 'bart'),
seed = 2
)
}
Expand Down
2 changes: 1 addition & 1 deletion thinkCausal/R/mod_analysis_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ mod_analysis_model_server <- function(id, store){
.weights = store$column_assignments$weight,
ran_eff = store$column_assignments$ran_eff,
.estimand = base::tolower(input$analysis_model_estimand),
random = store$analysis_select_design == 'Completely Randomized Experement'
rct = store$analysis_select_design == 'Completely Randomized Experement'
)
store$analysis$model$model <- bart_model

Expand Down

0 comments on commit 98d5fcc

Please sign in to comment.