Created
April 14, 2020 21:13
-
-
Save jwbowers/2d91fd40faa13520b29ebaa187c58e17 to your computer and use it in GitHub Desktop.
SimpleTestDeclareation.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Wrap a basic one-way t-test so that it's usable by the tidy functions | |
#' @param data The data that we pass in. See discussion of tidy_estimator and handlers in declare_estimator | |
#' @returns A data frame that contains quantities useful for assessing the design and estimator | |
our_ttest <- function(data) { | |
require(coin) | |
res <- coin::oneway_test( | |
outcome ~ factor(Xclus), | |
data = data, | |
distribution = "asymptotic" | |
) | |
data.frame(p.value = pvalue(res)[[1]]) | |
} | |
## This estimator wraps our_ttest so that is can be used by DeclareDesign | |
ttest_estimator <- declare_estimator( | |
handler = tidy_estimator(our_ttest), | |
label = "t test" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment