--- title: "Running Dropout related Tests with dropR" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Running Dropout related Tests with dropR} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ```{r setup, message=FALSE} library(dropR) data("dropRdemo") qs <- which(grepl("vi_", names(dropRdemo))) dropRdemo <- add_dropout_idx(dropRdemo, q_pos = qs) stats <- compute_stats(dropRdemo, by_cond = "experimental_condition", no_of_vars = length(qs)) ``` ### Running a Chi-sq. Test for a Selected Question > **_NOTE:_** Chi-sq. tests are only available when an column denoting the experimental condition is given. Let's compute a Chisq test at question 15 for experimentatl conditions `11` and `12`. dropR's dropout Chisq-Test returns a list containing the actual *test results* and dropout overview table at the selected question. ```{r} do_chisq(stats, chisq_question = 15, sel_cond_chisq = c('11','12'), p_sim = TRUE) ``` ### Kaplan-Meier Estimation ```{r} kpm <- do_kpm(df = add_dropout_idx(dropRdemo, qs), condition_col = "experimental_condition", model_fit = "total") kpm$model_fit head(kpm$steps) head(kpm$d) ```