Skip to content

Commit 67dc003

Browse files
Merge pull request #214 from easystats/dev
CRAN submission
2 parents 5b95078 + 81d6ffb commit 67dc003

32 files changed

Lines changed: 229 additions & 193 deletions

R/bayesfactor_inclusion.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ bayesfactor_inclusion.BFBayesFactor <- function(models, match_models = FALSE, pr
212212
tmp_terms <- make_terms(df.model$Modelnames[m])
213213
if (length(tmp_terms) > 0) {
214214
missing_terms <- !tmp_terms %in% colnames(df.model) # For R < 3.6.0
215-
if (any(missing_terms)) df.model[,tmp_terms[missing_terms]] <- NA # For R < 3.6.0
215+
if (any(missing_terms)) df.model[, tmp_terms[missing_terms]] <- NA # For R < 3.6.0
216216
df.model[m, tmp_terms] <- TRUE
217217
}
218218
}
@@ -240,4 +240,4 @@ bayesfactor_inclusion.BFBayesFactor <- function(models, match_models = FALSE, pr
240240
}
241241

242242
temp
243-
}
243+
}

R/bayesfactor_parameters.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ bayesfactor_parameters <- function(posterior, prior = NULL, direction = "two-sid
115115

116116
#' @rdname bayesfactor_parameters
117117
#' @export
118-
bayesfactor_savagedickey <- function(posterior, prior = NULL, direction = "two-sided", null = 0, verbose = TRUE, hypothesis = NULL,...) {
118+
bayesfactor_savagedickey <- function(posterior, prior = NULL, direction = "two-sided", null = 0, verbose = TRUE, hypothesis = NULL, ...) {
119119
.Deprecated("bayesfactor_parameters")
120120

121121
dots <- list(...)

R/ci.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,9 @@
3232
#' ci(df, method = "HDI", ci = c(.80, .89, .95))
3333
#'
3434
#' library(rstanarm)
35-
#' model <- stan_glm(mpg ~ wt + gear, data = mtcars, chains = 2, iter = 200)
35+
#' model <- stan_glm(mpg ~ wt, data = mtcars, chains = 2, iter = 200)
3636
#' ci(model, method = "ETI", ci = c(.80, .89))
3737
#' ci(model, method = "HDI", ci = c(.80, .89))
38-
#'
39-
#' library(emmeans)
40-
#' model <- emtrends(model, ~1, "wt")
41-
#' ci(model, method = "ETI")
42-
#' ci(model, method = "HDI")
4338
#' \dontrun{
4439
#' library(brms)
4540
#' model <- brms::brm(mpg ~ wt + cyl, data = mtcars)
@@ -50,6 +45,11 @@
5045
#' bf <- ttestBF(x = rnorm(100, 1, 1))
5146
#' ci(bf, method = "ETI")
5247
#' ci(bf, method = "HDI")
48+
#'
49+
#' library(emmeans)
50+
#' model <- emtrends(model, ~1, "wt")
51+
#' ci(model, method = "ETI")
52+
#' ci(model, method = "HDI")
5353
#' }
5454
#'
5555
#' @export

R/estimate_density.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,3 @@ density_at <- function(posterior, x, precision = 2^10, method = "kernel", ...) {
215215
density <- estimate_density(posterior, precision = precision, method = method, ...)
216216
stats::approx(density$x, density$y, xout = x)$y
217217
}
218-

R/p_map.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@
3434
#' # Robustness to density estimation method
3535
#' set.seed(333)
3636
#' data <- data.frame()
37-
#' for(iteration in 1:250){
37+
#' for (iteration in 1:250) {
3838
#' x <- rnorm(1000, 1, 1)
39-
#' result <- data.frame("Kernel" = p_map(x, method = "kernel"),
40-
#' "KernSmooth" = p_map(x, method = "KernSmooth"),
41-
#' "logspline" = p_map(x, method = "logspline"))
39+
#' result <- data.frame(
40+
#' "Kernel" = p_map(x, method = "kernel"),
41+
#' "KernSmooth" = p_map(x, method = "KernSmooth"),
42+
#' "logspline" = p_map(x, method = "logspline")
43+
#' )
4244
#' data <- rbind(data, result)
4345
#' }
4446
#' data$KernSmooth <- data$Kernel - data$KernSmooth

R/reshape_ci.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@
1818
#' reshape_ci(reshape_ci(x))
1919
#' @importFrom stats reshape
2020
#' @export
21-
reshape_ci <- function(x){
21+
reshape_ci <- function(x) {
2222

2323

2424
# Long to wide ----------------
2525
if ("CI_low" %in% names(x) & "CI_high" %in% names(x) & "CI" %in% names(x)) {
26-
2726
ci_position <- which(names(x) == "CI")
2827

2928
# Reshape
3029
if (length(unique(x$CI)) > 1) {
31-
3230
if (!"Parameter" %in% names(x)) {
3331
x$Parameter <- x$CI
3432
remove_parameter <- TRUE
@@ -56,8 +54,7 @@ reshape_ci <- function(x){
5654

5755

5856
# Wide to long --------------
59-
} else{
60-
57+
} else {
6158
if (!"Parameter" %in% names(x)) {
6259
x$Parameter <- 1:nrow(x)
6360
remove_parameter <- TRUE

R/utils.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,15 @@
8383
#' Used in describe_posterior
8484
#' @keywords internal
8585
.reoder_rows <- function(x, out, ci = NULL) {
86-
87-
if(!is.data.frame(out) || nrow(out) == 1){
86+
if (!is.data.frame(out) || nrow(out) == 1) {
8887
return(out)
8988
}
9089

91-
if(is.null(ci)){
90+
if (is.null(ci)) {
9291
refdata <- point_estimate(x, centrality = "median", dispersion = FALSE)
9392
order <- refdata$Parameter
9493
out <- out[match(order, out$Parameter), ]
95-
} else{
94+
} else {
9695
uncertainty <- ci(x, ci = ci)
9796
order <- paste0(uncertainty$Parameter, uncertainty$CI)
9897
out <- out[match(order, paste0(out$Parameter, out$CI)), ]

R/utils_hdi_ci.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,3 @@
178178
class(dat) <- unique(c(paste0("bayestestR_", fun), paste0("see_", fun), class(dat)))
179179
dat
180180
}
181-
182-
183-
184-
185-
186-

docs/CONTRIBUTING.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/example2.html

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)