Skip to content

Commit

Permalink
Properly deal with non-zero 'mumiss' value in fsn().
Browse files Browse the repository at this point in the history
  • Loading branch information
wviechtb committed Sep 10, 2023
1 parent 2903876 commit fe5ed56
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 10 deletions.
7 changes: 6 additions & 1 deletion R/fsn.r
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fsn <- function(x, vi, sei, subset, data, type, alpha=.05, target,
stop(mstyle$stop("Method only applicable to models without moderators."))

if (!missing(type) && type != "General")
warning(mstyle$warning("Setting type='General' when using fsn() on a model object. "), call.=FALSE)
warning(mstyle$warning("Setting type='General' when using fsn() on a model object."), call.=FALSE)

type <- "General"

Expand Down Expand Up @@ -365,6 +365,11 @@ fsn <- function(x, vi, sei, subset, data, type, alpha=.05, target,
tau2 <- tmp$tau2
pval <- tmp$pval

if (mumiss != 0 && sign(est) == sign(mumiss)) {
mumiss <- -mumiss
message(mstyle$message("Flipped the sign of 'mumiss'."))
}

if (is.null(target)) {

if (pval >= alpha) {
Expand Down
7 changes: 7 additions & 0 deletions R/misc.func.hidden.fsn.r
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
tau2.fsn <- tmp$tau2
pval.fsn <- tmp$pval

if (mumiss != 0 && sign(est.fsn) == sign(mumiss))
pval.fsn <- 1

} else {

k <- length(yi)
Expand Down Expand Up @@ -65,8 +68,12 @@
est.fsn <- mean(yinew)
zval.new <- (k + fsnum) * est.fsn / sqrt(sum(vi + tau2.fsn) + fsnum * (vt + tau2.fsn))
}

pval.fsn <- 2*pnorm(abs(zval.new), lower.tail=FALSE)

if (mumiss != 0 && sign(est.fsn * mumiss) == 1)
pval.fsn <- 1

}

if (newest) {
Expand Down
2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pkgdown: 2.0.7
pkgdown_sha: ~
articles:
diagram: pkgdown/diagram.html
last_built: 2023-09-10T15:37Z
last_built: 2023-09-10T16:22Z
urls:
reference: https://wviechtb.github.io/metafor/reference
article: https://wviechtb.github.io/metafor/articles
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/formula.rma.html

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

6 changes: 3 additions & 3 deletions docs/reference/fsn.html

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

2 changes: 1 addition & 1 deletion docs/reference/ranktest.html

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

4 changes: 2 additions & 2 deletions docs/reference/reporter.html

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

0 comments on commit fe5ed56

Please sign in to comment.