Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #11 #12

Merged
merged 6 commits into from
Jan 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
^NEWS$
^CONDUCT\.md$
^.*\.jpg$
^hex_inferr\.png$
5 changes: 1 addition & 4 deletions R/infer-binom-test.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
#' \item{exp_k}{expected number of successes}
#' \item{obs_p}{assumed probability of success}
#' \item{exp_p}{expected probability of success}
#' \item{ik}{the largest number <= \code{exp_k} such that Pr(k = ik) <= Pr(k = kobs)}
#' \item{lower}{lower one sided p value}
#' \item{upper}{upper one sided p value}
#' \item{two_tail}{two sided p value}
#' @section Deprecated Functions:
#' \code{binom_calc()} and \code{binom_test()} have been deprecated. Instead use
#' \code{infer_binom_cal()} and \code{infer_binom_test()}.
Expand Down Expand Up @@ -59,8 +57,7 @@ infer_binom_calc.default <- function(n, success, prob = 0.5, ...) {
k <- binom_comp(n, success, prob)

out <- list(n = n, k = k$k, exp_k = k$exp_k, obs_p = k$obs_p,
exp_p = k$exp_p, ik = k$ik, lower = k$lower, upper = k$upper,
two_tail = k$two_tail)
exp_p = k$exp_p, lower = k$lower, upper = k$upper)

class(out) <- 'infer_binom_calc'
return(out)
Expand Down
10 changes: 5 additions & 5 deletions R/infer-levene-test.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ infer_levene_test <- function(variable, ...) UseMethod('infer_levene_test')

#' @export
#' @rdname infer_levene_test
infer_levene_test.default <- function(variable, ..., group_var = NA,
infer_levene_test.default <- function(variable, ..., group_var = NULL,
trim.mean = 0.1) {

varname <- deparse(substitute(variable))

suppressWarnings(

if (is.na(group_var)) {

if (is.null(group_var)) {

if (is.data.frame(variable)) {
z <- as.list(variable)
Expand All @@ -96,7 +96,7 @@ infer_levene_test.default <- function(variable, ..., group_var = NA,

}

)


if (!is.factor(group_var)) {
group_var <- as.factor(group_var)
Expand Down Expand Up @@ -129,7 +129,7 @@ infer_levene_test.default <- function(variable, ..., group_var = NA,
#' @rdname infer_levene_test
#' @usage NULL
#'
levene_test <- function(variable, ..., group_var = NA,
levene_test <- function(variable, ..., group_var = NULL,
trim.mean = 0.1) {

.Deprecated("infer_levene_test()")
Expand Down
48 changes: 24 additions & 24 deletions R/infer-output.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ print_binom <- function(data) {

# test summary widths
w6 <- nchar('Lower')
w7 <- nchar(paste0('Pr(k <= ', data$ik, ' or k >= ', data$k, ')'))
w8 <- nchar(paste0('Pr(k <= ', data$k, ' or k >= ', data$ik, ')'))
w7 <- nchar(paste0('Pr(k <= ', data$k, ' or k >= ', data$k, ')'))
w8 <- nchar(paste0('Pr(k <= ', data$k, ' or k >= ', data$k, ')'))
w9 <- 8
w10 <- sum(w6, w7, w9, 9)
w11 <- sum(w6, w8, w9, 9)
Expand All @@ -97,17 +97,17 @@ print_binom <- function(data) {
cat(" ", format('Tail', width = w6, justify = 'left'), fs(), format('Prob', width = w8, justify = 'centre'), fs(),
format('p-value', width = w9, justify = 'centre'),'\n')
cat(" ", rep("-", w11), sep = "", '\n')
cat(" ", format('Lower', width = w6, justify = 'left'), fs(), format(paste0('Pr(k <= ', data$k, ')'), width = w8, justify = 'left'), fs(),
format(data$lower, width = w9, justify = 'centre'),'\n')
cat(" ", format('Upper', width = w6, justify = 'left'), fs(), format(paste0('Pr(k >= ', data$k, ')'), width = w8, justify = 'left'), fs(),
format(data$upper, width = w9, justify = 'centre'),'\n')
if (data$ik < 0) {
cat(" ", format('Two', width = w6, justify = 'left'), fs(), format(paste0('Pr(k >= ', data$ik, ')'), width = w8, justify = 'left'), fs(),
format(data$two_tail, width = w9, justify = 'centre'),'\n')
} else {
cat(" ", format('Two', width = w6, justify = 'left'), fs(), format(paste0('Pr(k <= ', data$k, ' or k >= ', data$ik, ')'), width = w8, justify = 'left'), fs(),
format(data$two_tail, width = w9, justify = 'centre'),'\n')
}
cat(" ", format('Lower', width = w6, justify = 'left'), fs(), format(paste0('Pr(k <= ', data$k, ')'), width = w8, justify = 'centre'), fs(),
format(as.character(data$lower), width = w9, justify = 'centre'),'\n')
cat(" ", format('Upper', width = w6, justify = 'left'), fs(), format(paste0('Pr(k >= ', data$k, ')'), width = w8, justify = 'centre'), fs(),
format(as.character(data$upper), width = w9, justify = 'centre'),'\n')
# if (data$ik < 0) {
# cat(" ", format('Two', width = w6, justify = 'left'), fs(), format(paste0('Pr(k >= ', data$ik, ')'), width = w8, justify = 'left'), fs(),
# format(data$two_tail, width = w9, justify = 'centre'),'\n')
# } else {
# cat(" ", format('Two', width = w6, justify = 'left'), fs(), format(paste0('Pr(k <= ', data$k, ' or k >= ', data$ik, ')'), width = w8, justify = 'left'), fs(),
# format(data$two_tail, width = w9, justify = 'centre'),'\n')
# }
cat(" ", rep("-", w11), sep = "", '\n')

} else {
Expand All @@ -117,17 +117,17 @@ print_binom <- function(data) {
cat(" ", format('Tail', width = w6, justify = 'left'), fs(), format('Prob', width = w7, justify = 'centre'), fs(),
format('p-value', width = w9, justify = 'centre'),'\n')
cat(" ", rep("-", w10), sep = "", '\n')
cat(" ", format('Lower', width = w6, justify = 'left'), fs(), format(paste0('Pr(k <= ', data$k, ')'), width = w7, justify = 'left'), fs(),
format(data$lower, width = w9, justify = 'centre'),'\n')
cat(" ", format('Upper', width = w6, justify = 'left'), fs(), format(paste0('Pr(k >= ', data$k, ')'), width = w7, justify = 'left'), fs(),
format(data$upper, width = w9, justify = 'centre'),'\n')
if (data$ik < 0) {
cat(" ", format('Two', width = w6, justify = 'left'), fs(), format(paste0('Pr(k >= ', data$k, ')'), width = w7, justify = 'left'), fs(),
format(data$two_tail, width = w9, justify = 'centre'),'\n')
} else {
cat(" ", format('Two', width = w6, justify = 'left'), fs(), format(paste0('Pr(k <= ', data$ik, ' or k >= ', data$k, ')'), width = w7, justify = 'left'), fs(),
format(data$two_tail, width = w9, justify = 'centre'),'\n')
}
cat(" ", format('Lower', width = w6, justify = 'left'), fs(), format(paste0('Pr(k <= ', data$k, ')'), width = w7, justify = 'centre'), fs(),
format(as.character(data$lower), width = w9, justify = 'centre'),'\n')
cat(" ", format('Upper', width = w6, justify = 'left'), fs(), format(paste0('Pr(k >= ', data$k, ')'), width = w7, justify = 'centre'), fs(),
format(as.character(data$upper), width = w9, justify = 'centre'),'\n')
# if (data$ik < 0) {
# cat(" ", format('Two', width = w6, justify = 'left'), fs(), format(paste0('Pr(k >= ', data$k, ')'), width = w7, justify = 'left'), fs(),
# format(data$two_tail, width = w9, justify = 'centre'),'\n')
# } else {
# cat(" ", format('Two', width = w6, justify = 'left'), fs(), format(paste0('Pr(k <= ', data$ik, ' or k >= ', data$k, ')'), width = w7, justify = 'left'), fs(),
# format(data$two_tail, width = w9, justify = 'centre'),'\n')
# }
cat(" ", rep("-", w10), sep = "", '\n')

}
Expand Down
11 changes: 7 additions & 4 deletions docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading