Commit 96f6d653 authored by Chris Jewell's avatar Chris Jewell
Browse files

Swapped order of credible intervals.

parent 330a247a
......@@ -32,8 +32,8 @@ ci_chenShao = function(x, alpha) {
}
return(c(
median = stats::median(sorted),
lower = ci.lower,
median = stats::median(sorted),
upper = ci.upper
))
}
......@@ -51,8 +51,8 @@ ci_percentiles <- function(x, alpha) {
lower_pos <- round(n * (alpha / 2))
return(c(
median = stats::median(x),
lower = sorted[lower_pos],
median = stats::median(x),
upper = sorted[upper_pos]
))
}
......@@ -71,8 +71,8 @@ ci_SPIn <- function(x, alpha) {
return(c(NA, NA))
})
return(c(
median = stats::median(x),
lower = region[1],
median = stats::median(x),
upper = region[2]
))
}
......@@ -1053,12 +1053,15 @@ HaldDP <- R6::R6Class(
alpha=alpha,
CI_type=CI_type))
names(res)[1] = 'ci'
dimnames(res)$ci = c('lower','median','upper')
res
},
calc_CI_q = function(object, alpha, CI_type)
{
res = as.tensor(apply(object, 'type', private$calc_CI, alpha=alpha, CI_type=CI_type))
names(res)[1] = 'ci'
dimnames(res)$ci = c('lower','median','upper')
res
},
calc_CI_r = function(object, alpha, CI_type)
{
......@@ -1067,6 +1070,8 @@ HaldDP <- R6::R6Class(
alpha=alpha,
CI_type=CI_type))
names(res)[1] = 'ci'
dimnames(res)$ci = c('lower','median','upper')
res
},
calc_CI_lambda_i = function(object, alpha, CI_type)
{
......@@ -1075,6 +1080,8 @@ HaldDP <- R6::R6Class(
alpha=alpha,
CI_type=CI_type))
names(res)[1] = 'ci'
dimnames(res)$ci = c('lower','median','upper')
res
},
calc_CI_lambda_j = function(object, alpha, CI_type)
{
......@@ -1083,6 +1090,8 @@ HaldDP <- R6::R6Class(
alpha=0.05,
CI_type=CI_type))
names(res)[1] = 'ci'
dimnames(res)$ci = c('lower','median','upper')
res
},
check_extract_summary_params = function(params,
times,
......@@ -1541,20 +1550,21 @@ HaldDP <- R6::R6Class(
switch(
x,
"alpha" = private$flatten_alpha(res$alpha),
"q" = private$flatten_q_s(res$q),
"q" = private$flatten_q_s(res$q, names='q'),
"r" = private$flatten_r(res$r),
"lambda_i" = private$flatten_lambda_i(res$lambda_i),
"lambda_j" = private$flatten_lambda_j(res$lambda_j),
"lambda_j_prop" = private$flatten_lambda_j(res$lambda_j),
"s" = private$flatten_q_s(res$s, names='s'),
stop("Unrecognised model component")
)
}))
res <- as.data.frame(res)
if ("s" %in% params) {
tmp <-
as.data.frame(private$flatten_q_s(res$s, names = "s"))
res <- cbind(res, tmp)
}
# if ("s" %in% params) {
# tmp <-
# as.data.frame(private$flatten_q_s(res$s, names = "s"))
# res <- cbind(res, tmp)
# }
}
res
},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment