Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jun 11, 2020
1 parent 07031ff commit b734d83
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ S3method(ci,logitmfx)
S3method(ci,logitor)
S3method(ci,lrm)
S3method(ci,merMod)
S3method(ci,metaplus)
S3method(ci,mixor)
S3method(ci,mlm)
S3method(ci,multinom)
Expand Down Expand Up @@ -315,6 +316,7 @@ S3method(p_value,logitor)
S3method(p_value,lrm)
S3method(p_value,maxLik)
S3method(p_value,merMod)
S3method(p_value,metaplus)
S3method(p_value,mixor)
S3method(p_value,mlm)
S3method(p_value,multinom)
Expand Down Expand Up @@ -563,6 +565,7 @@ S3method(standard_error,logitmfx)
S3method(standard_error,logitor)
S3method(standard_error,lrm)
S3method(standard_error,merMod)
S3method(standard_error,metaplus)
S3method(standard_error,mixor)
S3method(standard_error,mlm)
S3method(standard_error,multinom)
Expand Down
14 changes: 14 additions & 0 deletions R/ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,20 @@ ci.rma <- function(x, ci = .95, ...) {



#' @export
ci.metaplus <- function(x, ...) {
out <- .data_frame(
Parameter = .remove_backticks_from_string(rownames(x$results)),
CI_low = as.vector(x$results[, "95% ci.lb"]),
CI_high = as.vector(x$results[, "95% ci.ub"])
)

out$Parameter[grepl("muhat", out$Parameter)] <- "(Intercept)"
out
}






Expand Down
12 changes: 12 additions & 0 deletions R/p_value.R
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,18 @@ p_value.rma <- function(model, ...) {
}


#' @export
p_value.metaplus <- function(model, ...) {
out <- .data_frame(
Parameter = .remove_backticks_from_string(rownames(model$results)),
p = as.vector(model$results[, "pvalue"])
)

out$Parameter[grepl("muhat", out$Parameter)] <- "(Intercept)"
out
}


#' @export
p_value.lavaan <- function(model, ...) {
out <- .extract_parameters_lavaan(model, ...)
Expand Down
17 changes: 17 additions & 0 deletions R/standard_error.R
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,23 @@ standard_error.rma <- function(model, ...) {



#' @export
standard_error.metaplus <- function(model, ...) {
ci_low <- as.vector(model$results[, "95% ci.lb"])
ci_high <- as.vector(model$results[, "95% ci.ub"])
cis <- apply(cbind(ci_low, ci_high), MARGIN = 1, diff)

out <- .data_frame(
Parameter = .remove_backticks_from_string(rownames(model$results)),
SE = cis / (2 * stats::qnorm(.975))
)

out$Parameter[grepl("muhat", out$Parameter)] <- "(Intercept)"
out
}



#' @rdname standard_error
#' @export
standard_error.averaging <- function(model, component = c("conditional", "full"), ...) {
Expand Down

0 comments on commit b734d83

Please sign in to comment.