-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathmethods_modelbased.R
More file actions
56 lines (41 loc) · 1.18 KB
/
methods_modelbased.R
File metadata and controls
56 lines (41 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# model_parameters ----------------
#' @export
model_parameters.estimate_means <- function(model, ...) {
out <- model
class(out) <- c("parameters_model", "see_parameters_model", class(out))
out
}
#' @export
model_parameters.estimate_slopes <- model_parameters.estimate_means
#' @export
model_parameters.estimate_contrasts <- model_parameters.estimate_means
# standard_error ----------------
#' @export
standard_error.estimate_means <- function(model, ...) {
params <- insight::get_parameters(model)
data.frame(Parameter = params$Parameter, SE = model$SE, stringsAsFactors = FALSE)
}
#' @export
standard_error.estimate_slopes <- standard_error.estimate_means
#' @export
standard_error.estimate_contrasts <- standard_error.estimate_means
# ci ----------------
#' @export
ci.estimate_means <- function(x, ...) {
params <- insight::get_parameters(x)
ci_value <- attributes(x)$ci
if (is.null(ci_value)) {
ci_value <- 0.95
}
data.frame(
Parameter = params$Parameter,
CI = ci_value,
CI_low = x$CI_low,
CI_high = x$CI_high,
stringsAsFactors = FALSE
)
}
#' @export
ci.estimate_slopes <- ci.estimate_means
#' @export
ci.estimate_contrasts <- ci.estimate_means