diff --git a/thinkCausal/R/mod_analysis_balance.R b/thinkCausal/R/mod_analysis_balance.R index 5ffeddac..0feee7d3 100644 --- a/thinkCausal/R/mod_analysis_balance.R +++ b/thinkCausal/R/mod_analysis_balance.R @@ -158,23 +158,33 @@ mod_analysis_balance_server <- function(id, store){ treatment_col <- grep("^Z_", names(X), value = TRUE) outcome_col <- grep("^Y_", names(X), value = TRUE) - if(input$analysis_balance_select == 'Plot varibables with most imbalance'){ - .confounders <- colnames(X)[colnames(X)%notin% c(treatment_col, outcome_col)] + if(input$analysis_balance_select == 'Plot variables with most imbalance'){ + .confounders <- colnames(X)[colnames(X) %notin% c(treatment_col, outcome_col)] + # stop here if there are no columns selected + validate(need(length(.confounders) > 0, + "No columns available or currently selected")) + p <- plotBart::plot_balance(.data = X, + treatment = treatment_col, + confounders = .confounders, + compare = input$analysis_balance_type, + estimand = input$analysis_balance_estimand, + limit_catagorical = input$analysis_balance_cat + 1, + limit_continuous = input$analysis_balance_cont + 1 + ) }else{ .confounders <- input$analysis_balance_select_var + # stop here if there are no columns selected + validate(need(length(.confounders) > 0, + "No columns available or currently selected")) + p <- plotBart::plot_balance(.data = X, + treatment = treatment_col, + confounders = .confounders, + compare = input$analysis_balance_type, + estimand = input$analysis_balance_estimand + ) } - # stop here if there are no columns selected - validate(need(length(.confounders) > 0, - "No columns available or currently selected")) - p <- plotBart::plot_balance(.data = X, - treatment = treatment_col, - confounders = .confounders, - compare = input$analysis_balance_type, - estimand = input$analysis_balance_estimand, - limit_catagorical = input$analysis_balance_cat, - limit_continuous = input$analysis_balance_cont - ) + # add theme p <- p & store$options$theme_custom + ggplot2::theme(legend.position = 'none') diff --git a/thinkCausal/R/mod_analysis_visualize.R b/thinkCausal/R/mod_analysis_visualize.R index ac228d90..ca2d0540 100644 --- a/thinkCausal/R/mod_analysis_visualize.R +++ b/thinkCausal/R/mod_analysis_visualize.R @@ -133,7 +133,7 @@ mod_analysis_visualize_ui <- function(id){ ), selectInput( inputId = ns("analysis_eda_variable_facet"), - label = "Panel variable: ", + label = "Group by: ", multiple = FALSE, choices = c("None", NULL), selected = "None" @@ -143,7 +143,7 @@ mod_analysis_visualize_ui <- function(id){ ns = ns, selectInput( inputId = ns("analysis_eda_variable_facet_second"), - label = "Second panel variable: ", + label = "Group by second variable: ", multiple = FALSE, choices = c("None"), selected = "None" diff --git a/thinkCausal/R/mod_learn_colinearity.R b/thinkCausal/R/mod_learn_colinearity.R index a69328af..d13b023e 100644 --- a/thinkCausal/R/mod_learn_colinearity.R +++ b/thinkCausal/R/mod_learn_colinearity.R @@ -58,7 +58,7 @@ mod_learn_colinearity_server <- function(id, id_parent = 'learn_variable_selecti ns <- session$ns #ns <- NS(NS(id_parent)(id)) - dat <- readr::read_csv('inst/extdata/colinearity.csv') + dat <- readr::read_csv(app_sys('extdata/colinearity.csv')) dat$ITE <- with(dat, Y1 - Y0) dat$runner <- 1:500 dat <- dat %>% dplyr::select(runner, dplyr::everything()) diff --git a/thinkCausal/inst/app/www/img/example_balance.png b/thinkCausal/inst/app/www/img/example_balance.png new file mode 100644 index 00000000..709bfd18 Binary files /dev/null and b/thinkCausal/inst/app/www/img/example_balance.png differ diff --git a/thinkCausal/inst/app/www/md/help.md b/thinkCausal/inst/app/www/md/help.md index 21f8a4e2..683d2ed8 100644 --- a/thinkCausal/inst/app/www/md/help.md +++ b/thinkCausal/inst/app/www/md/help.md @@ -6,6 +6,9 @@ This is still under development ### Upload data + +After clicking the browse button you can select any file available on your computer. + thinkCausal can load in .csv, .txt, .xlsx (Excel), .spss (SPSS), .sav (SPSS), .dta (STATA) or .sas (SAS) files.
@@ -114,7 +117,9 @@ In block randomized experiments it is important to always adjust for the variabl #### Survey weights -Sometimes our data comes from surveys that are not representative of the population we are inferences about. +Sometimes our data comes from surveys that are not representative of the population we are inferences about. If your dataset contains survey weights, indicate *yes* for the the Include survey weights input under Advanced Options. + +If your dataset does not contrain survey weights leave this input as *no* which is the default option.
@@ -144,7 +149,7 @@ Use the drag-and-drop to include additional variables in the analysis. You may c You can move all the variables in your dataset by clicking "Move all covariates to include box". -**After you have selected variables to include in the analysis click on the "Save variable selection & continue" button. +**After you have selected variables to include in the analysis click on the "Save variable selection & continue" button**.