Binary files /tmp/tmp5uq3f04n/Dj10pNa1vy/r-cran-metap-1.6/build/metap.pdf and /tmp/tmp5uq3f04n/ots4pfs7xx/r-cran-metap-1.7/build/metap.pdf differ Binary files /tmp/tmp5uq3f04n/Dj10pNa1vy/r-cran-metap-1.6/build/partial.rdb and /tmp/tmp5uq3f04n/ots4pfs7xx/r-cran-metap-1.7/build/partial.rdb differ Binary files /tmp/tmp5uq3f04n/Dj10pNa1vy/r-cran-metap-1.6/build/vignette.rds and /tmp/tmp5uq3f04n/ots4pfs7xx/r-cran-metap-1.7/build/vignette.rds differ Binary files /tmp/tmp5uq3f04n/Dj10pNa1vy/r-cran-metap-1.6/data/dat.metap.rda and /tmp/tmp5uq3f04n/ots4pfs7xx/r-cran-metap-1.7/data/dat.metap.rda differ diff -Nru r-cran-metap-1.6/debian/changelog r-cran-metap-1.7/debian/changelog --- r-cran-metap-1.6/debian/changelog 2021-11-07 15:07:05.000000000 +0000 +++ r-cran-metap-1.7/debian/changelog 2021-12-21 10:50:19.000000000 +0000 @@ -1,3 +1,10 @@ +r-cran-metap (1.7-1) unstable; urgency=medium + + * Team upload. + * New upstream version + + -- Andreas Tille Tue, 21 Dec 2021 11:50:19 +0100 + r-cran-metap (1.6-1) unstable; urgency=medium * Team upload. diff -Nru r-cran-metap-1.6/DESCRIPTION r-cran-metap-1.7/DESCRIPTION --- r-cran-metap-1.6/DESCRIPTION 2021-11-05 13:30:02.000000000 +0000 +++ r-cran-metap-1.7/DESCRIPTION 2021-12-16 16:50:02.000000000 +0000 @@ -1,8 +1,8 @@ Package: metap Type: Package Title: Meta-Analysis of Significance Values -Version: 1.6 -Date: 2021-10-31 +Version: 1.7 +Date: 2021-12-16 Authors@R: person("Michael", "Dewey", role = c("aut", "cre"), email = "lists@dewey.myzen.co.uk", comment = c(ORCID = "0000-0002-7522-3677") @@ -11,7 +11,7 @@ When they are not available this package provides a number of methods for meta-analysis of significance values including the methods of Edgington, Fisher, Lancaster, Stouffer, Tippett, and Wilkinson; a number of data-sets to replicate published results; - and a routine for graphical display. + and routines for graphical display. URL: http://www.dewey.myzen.co.uk/meta/meta.html Depends: R (>= 3.5.0) Imports: lattice,Rdpack (>= 0.7),TFisher,mutoss,mathjaxr (>= 0.8-3) @@ -19,8 +19,8 @@ License: GPL-2 LazyLoad: yes NeedsCompilation: no -Packaged: 2021-10-31 13:34:11 UTC; MichaelUser +Packaged: 2021-12-16 14:46:57 UTC; MichaelUser Author: Michael Dewey [aut, cre] () Maintainer: Michael Dewey Repository: CRAN -Date/Publication: 2021-11-05 13:30:02 UTC +Date/Publication: 2021-12-16 16:50:02 UTC Binary files /tmp/tmp5uq3f04n/Dj10pNa1vy/r-cran-metap-1.6/inst/doc/compare.pdf and /tmp/tmp5uq3f04n/ots4pfs7xx/r-cran-metap-1.7/inst/doc/compare.pdf differ Binary files /tmp/tmp5uq3f04n/Dj10pNa1vy/r-cran-metap-1.6/inst/doc/metap.pdf and /tmp/tmp5uq3f04n/ots4pfs7xx/r-cran-metap-1.7/inst/doc/metap.pdf differ diff -Nru r-cran-metap-1.6/inst/REFERENCES.bib r-cran-metap-1.7/inst/REFERENCES.bib --- r-cran-metap-1.6/inst/REFERENCES.bib 2019-11-15 11:48:46.000000000 +0000 +++ r-cran-metap-1.7/inst/REFERENCES.bib 2021-11-24 13:41:15.000000000 +0000 @@ -156,3 +156,28 @@ year = {2018}, url = {https://arxiv.org/abs/1801.04309} } +@article{harrison17, + author = {Harrison, S and Jones, H E and Martin, R M and + Lewis, S J and Higgins, J P T}, + title = {The albatros plot: {A} novel graphical tool + for presenting the results of diversely reported + studies in a systematic review}, + journal = {Research Synthesis Methods}, + year = {2017}, + volume = {8}, + pages = {281--289} +} +@article{zhang16, + author = {Zhang, Y--M and Lu, Y and Yang, D and Wu, H--F and + Bian, Z--P and Xu, J--D and Gu, C--R and Wang, L--S and + Chen, X--J}, + title = {The effects of different initiation time of + exercise training on left ventricular remodeling + and cardiopulmonary rehabilitation in patients + with left ventricular dysfunction after + myocardial infarction}, + journal = {Disability and Rehabilitation}, + year = {2016}, + volume = {38}, + pages = {268--276} +} diff -Nru r-cran-metap-1.6/man/albatros.Rd r-cran-metap-1.7/man/albatros.Rd --- r-cran-metap-1.6/man/albatros.Rd 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-metap-1.7/man/albatros.Rd 2021-12-14 11:34:53.000000000 +0000 @@ -0,0 +1,129 @@ +\name{albatros} +\alias{albatros} +\alias{docontours} +%- Also NEED an '\alias' for EACH other topic documented here. +\title{Albatros plot} +\description{Produces the albatros plot of Harrison et al\loadmathjax} +\usage{ +albatros(p, n, axes = list(xlimit = NULL, ylimit = NULL, + lefttext = NULL, righttext = NULL), + contours = list(type = NULL, contvals = NULL, ltys = NULL, contlabs = NULL), + plotpars = list(yscale = NULL, pchs = NULL, cols = NULL), ...) +docontours(conttype, xvals, contvals, xtrans, ytrans, + xlims, ylims, ltys, contlabs) +} +\arguments{ + \item{p}{A vector of \mjseqn{p} values} + \item{n}{A vector of sample sizes} + \item{axes}{A list containing + \itemize{ + \item \code{xlimit} a single value, the limit + for the x-axis which is used symmetrically + \item \code{ylimit} a vector of length 2, limits for the y-axis + \item \code{lefttext} character, to label below plot + \item \code{righttext} character, to label below plot + } + } + \item{contours}{A list containing + \itemize{ + \item \code{type} what effect size to use, a character one of "corr", + "or", "smd" + \item \code{contvals} a vector, what values to draw the contours at + \item \code{ltys} a vector, what line types to use + } + } + \item{plotpars}{A list containing + \itemize{ + \item \code{yscale} Scaling for y-axis, See details + \item \code{pchs} Symbols to be used + \item \code{cols} Colours for points + } + } + \item{\dots}{Arguments to be passed through to \code{plot}} + \item{conttype}{Character: one of "smd", "or", "corr"} + \item{xvals}{A vector of values to evaluate the contour} + \item{contvals}{The values at which contours are drawn} + \item{xtrans}{A function for transforming the x-axis} + \item{ytrans}{A function for transforming the y-axis} + \item{xlims}{The limits for the x-axis in plotting units} + \item{ylims}{The limits for the y-axis in plottng units} + \item{ltys}{A vector of line types for the contours} + \item{contlabs}{Logical, draw the labels of the contours?} +} +\details{Plots \mjseqn{n} against \mjseqn{p} and draws contours of +constant effect size. +\insertNoCite{harrison17}{metap} + +The \mjseqn{p} value scale on the x-axis is a logarithmic one +but folded at the null value so that the extreme values represent +small probabilities in each direction. +The scale for the y-axis is user selectable. +The original scale in the Stata version is +\mjeqn{(\log_{10}n)^2}{log(n, base = 10) ^ 2} which is obtained by +setting \code{yscale} to "classic" +but it is +also possible to use \mjeqn{\sqrt{n}}{sqrt(n)} +which is the default or \mjseqn{n} by setting +\code{yscale} to "n". +If the dataset contains extreme values the +plot may be uninformative and the \code{xlimit} +and \code{ylimit} parameters my be helpful to clip +the plot. +If they are not specified the function tries +to choose suitable values. + +For the contours if the \code{type} parameter in \code{contours} +is NULL (the default) no contours will be plotted. +The options available are +\dQuote{smr} (Standardised mean difference) +\dQuote{corr} (Correlation) +\dQuote{or} (Odds ratio). + +The contours are labelled unless contlabs is set to \code{FALSE}. +The function tries to position these so they are not obscured +by the contour lines but if that is unsatisfactory then +it is best to suppress them and position them manually +or use a legend to identify line types. + +The \code{pch} parameter may either be a single value +or a vector of the same length as \code{p}. +It may contain anything which is legal as input to +the parameter of the same name in the graphics +library and will be used for the plotted points. +The \code{cols} parameter works similarly. + +The values of \code{lefttext} and \code{righttext} are +used to produce labels under the \mjseqn{x}-axis and +are placed level with the label. +By default they are not produced. + +The return values from the function may be useful if further +annotations are required as they give the axis limits in +plotting units. +} +\value{Returns +A list containing + \item{xlims}{The limits for the x-axis in plotting units} + \item{ylims}{The limits for the y-axis in plotting units} +} +\references{ +\insertAllCited{} +} +\author{Michael Dewey} +\note{The docontours function is for internal use only} + +%% ~Make other sections like Warning with \section{Warning }{....} ~ + +\seealso{For plotting parameters +see \code{\link{par}} +} +\examples{ +data(dat.metap) +validity <- dat.metap$validity +fit <- albatros(validity$p, validity$n, + contours = list(type = "corr", contvals = c(0.25, 0.5, 0.8), ltys = 1:3), + axes = list(ylimit = c(1,200), lefttext = "Negative correlation", + righttext = "Positive correlation"), + main = "Validity") +} +\keyword{hplot} diff -Nru r-cran-metap-1.6/man/allmetap.Rd r-cran-metap-1.7/man/allmetap.Rd --- r-cran-metap-1.6/man/allmetap.Rd 2021-09-13 08:26:11.000000000 +0000 +++ r-cran-metap-1.7/man/allmetap.Rd 2021-11-10 14:19:10.000000000 +0000 @@ -5,12 +5,13 @@ \description{Enables all or a selected number of the package methods to be executed on the same dataset\loadmathjax} \usage{ -allmetap(p, method = NULL) +allmetap(p, method = NULL, log.p = FALSE) \method{print}{allmetap}(x, digits = 5, ...) } \arguments{ \item{p}{A vector of \mjseqn{p}-values} \item{method}{A vector of character containing names of methods or \sQuote{\code{all}}} + \item{log.p}{Logical, are the \mjseqn{p}-values passed as logs?} \item{x}{An object of class \sQuote{\code{allmetap}}} \item{digits}{How many digits to print?} \item{...}{Other arguments to be passed through} diff -Nru r-cran-metap-1.6/man/dat.metap.Rd r-cran-metap-1.7/man/dat.metap.Rd --- r-cran-metap-1.6/man/dat.metap.Rd 2021-10-31 13:29:48.000000000 +0000 +++ r-cran-metap-1.7/man/dat.metap.Rd 2021-11-24 14:58:05.000000000 +0000 @@ -13,7 +13,8 @@ \description{ The package contains the following datasets: \code{beckerp}, \code{cholest}, \code{edgington}, \code{mourning}, \code{naep}, - \code{rosenthal}, \code{teachexpect}, and \code{validity}. + \code{rosenthal}, \code{teachexpect}, \code{validity}, + and \code{zhang}. \loadmathjax} \usage{data(dat.metap) } @@ -65,6 +66,23 @@ \item{\code{p}}{a numeric vector of one sided \mjseqn{p} values} } } + \item{\code{zhang}}{ + A data frame with 22 observations on the following 11 variables + \describe{ + \item{\code{study}}{Character, the study names} + \item{\code{smd}}{numeric, the standardised mean difference} + \item{\code{lo}}{numeric, the lower confidence limit} + \item{\code{hi}}{numeric, the upper confidence limit} + \item{\code{ntreat}}{numeric, the treated sample size} + \item{\code{ncont}}{numeric, the control sample size} + \item{\code{n}}{numeric, the total sample size} + \item{\code{phase}}{factor, what phase the patients were in: + acute, healing, healed} + \item{\code{sd}}{numeric, the calculated standard deviation} + \item{\code{z}}{numeric, the calculated z} + \item{\code{p}}{numeric, the probability associated with z} + } + } } } \details{ @@ -88,10 +106,17 @@ student ratings of their instructors from \insertCite{becker94;textual}{metap} including correlations and sample sizes as well as \mjseqn{p}-values} + \item{\code{zhang}}{Data from trials of exercise training for + patients with cardiovascular disease from + \insertCite{zhang16;textual}{metap} } } +} \author{Michael Dewey} +\note{The \mjseqn{p}-values in \code{cholest} have been re-calculated +and are of higher accuracy than the ones given in the book.} + \references{ \insertAllCited{} } diff -Nru r-cran-metap-1.6/man/metap-package.Rd r-cran-metap-1.7/man/metap-package.Rd --- r-cran-metap-1.6/man/metap-package.Rd 2020-05-30 13:35:41.000000000 +0000 +++ r-cran-metap-1.7/man/metap-package.Rd 2021-11-25 16:19:18.000000000 +0000 @@ -16,6 +16,8 @@ and Spjotvoll \insertCite{schweder82}{metap} and the lowest slope line of Benjamini and Hochberg \insertCite{benjamini00}{metap}. +The albatros plot of Harrison et al \insertCite{harrison17}{metap} +is also provided. Some further documentation and, possibly, a development version diff -Nru r-cran-metap-1.6/MD5 r-cran-metap-1.7/MD5 --- r-cran-metap-1.6/MD5 2021-11-05 13:30:02.000000000 +0000 +++ r-cran-metap-1.7/MD5 2021-12-16 16:50:02.000000000 +0000 @@ -1,7 +1,9 @@ -990bf25eee90ff77471c2d6bca8bbaa0 *DESCRIPTION -ea972b12e23e74bf73c012a540831faf *NAMESPACE -51b375a9a3c8540ee53da1a8bc2a3ab6 *NEWS -3ba175b8ffcc09e0edf75e600d22a2e6 *R/allmetap.R +087e226ca5b839a2a4231ed7bd2f1705 *DESCRIPTION +92714325113919c356608d3497d3f8ee *NAMESPACE +4b702612e5da8ed0e86fe2a71e22e2de *NEWS +23e1682562f892b0605211f0b6c442f8 *R/albatros.R +0b97ddfeb684e54f5559b372b768fcdc *R/allmetap.R +705c542ea7db53aaa1e17ee45927cab4 *R/docontours.R 191881d946e0098602327fbbf65c575b *R/invchisq.R 527edfb3c95e8aa117a614aeaf2b71c4 *R/invt.R 4deafc927a12996fa035cf2b02754570 *R/logitp.R @@ -16,29 +18,30 @@ 150815c790f650c63f8268d4b2debe64 *R/two2one.R 40035f88c2c37f8fe9a28af64f9c0f6a *R/votep.R 74400ecd8eb938f157c765489365ec54 *R/wilkinsonp.R -1fea8013f06bf165fddfdefbfe4ea3fe *build/metap.pdf -733c92b7d5eac171b4b9fa2bbc0993b3 *build/partial.rdb -06760e63a3315224804068a2270f0ca9 *build/vignette.rds -9612cb405c4be046e0aa42956cfa5418 *data/dat.metap.rda +ebd1b1703ca729bc4e3a1b11b62e9f22 *build/metap.pdf +3ba481f8d730f722d4413776d3951bab *build/partial.rdb +5fa6f13ceffb86821074841a69a8bfc4 *build/vignette.rds +72b809043be449e3941dcf8f277c9a1b *data/dat.metap.rda 2b1e71b2097a6f3f4315a28990761bcf *inst/CITATION -6e5cb34960a8c2a2d11346d3bf69b51e *inst/REFERENCES.bib +7acacd0b85c9c40968430d8ed5a2b0a2 *inst/REFERENCES.bib 45d1b00638f7c20a5e766104c52ea478 *inst/doc/compare.R 33df473c4d0a90d0183de5fc81cc2f99 *inst/doc/compare.Rnw -ef8aecda1f2dcee9bc0bee1ac4b056c4 *inst/doc/compare.pdf +67ee27c00ea8ae31b0b65f31230cf923 *inst/doc/compare.pdf 328be9b276fcc318431fd51e4f1ce3cd *inst/doc/metap.R c12f7c432ced992d1189cd2cb4b0c31c *inst/doc/metap.Rnw -18685ec70a09401e809375ab617d8d29 *inst/doc/metap.pdf +924dfd2a0d802f1fe72b0d65caba5c5a *inst/doc/metap.pdf 86684c71af0565e2a25f91b8bcdf8d9c *inst/doc/strength.gv 40c2afb2ad3e5befc1b4d6e8f3329719 *inst/doc/struct.gv -5fef5064c7868c18a353775b3a301d56 *man/allmetap.Rd -f5ae0b6e1a1b1c083bb34f2013d8c5fe *man/dat.metap.Rd +f93bdd3867717ef281456b4567b1cf10 *man/albatros.Rd +88b8668f0ea0e7ac42c52b7e8b6d45aa *man/allmetap.Rd +254f29c06c93eec1f7c48d9397809798 *man/dat.metap.Rd 5e26ddb4b445c07eda0d4a1bad655e39 *man/invchisq.Rd b5b8d70e13f51f93c0bafada661cef87 *man/invt.Rd 134a47b9284c6a27375f004ba39fa289 *man/logitp.Rd d581087d0f484a95633f36ce91243abf *man/macros/macros.Rd 903c62b430062d42a91fc2018bf78f23 *man/meanp.Rd 720d1310fb73618c4ab2e94fca79a2f9 *man/meanz.Rd -3bd0d57bbd5c6141c46fbd012aa2a667 *man/metap-package.Rd +61dc347ae97f5bf2569ebbbcc6e8fcb8 *man/metap-package.Rd a7d2980b3e91788b0087118ba469b970 *man/plotp.Rd 8d24210f2c2515c9f8508bea9a9d9e2c *man/schweder.Rd dd9f882d30e2e64c22921226b4e98993 *man/sumlog.Rd diff -Nru r-cran-metap-1.6/NAMESPACE r-cran-metap-1.7/NAMESPACE --- r-cran-metap-1.6/NAMESPACE 2020-05-29 14:19:16.000000000 +0000 +++ r-cran-metap-1.7/NAMESPACE 2021-11-25 16:17:52.000000000 +0000 @@ -1,3 +1,4 @@ +export(albatros) export(allmetap) export(invchisq) export(invt) @@ -32,11 +33,11 @@ S3method(plot,truncated) S3method(print,wilkinsonp) S3method(plot,metap) -importFrom("graphics", "abline", "plot") +importFrom("graphics", "abline", "axis", "lines", "mtext", "plot", "text") importFrom("stats", "binom.test", "coef", "lm", "na.fail", "pbeta", "pchisq", "pnorm", "ppoints", "pt", "qbeta", "qchisq", "qnorm", "qqline", "qqplot", "qunif", - "qt", "sd") + "qt", "sd", "spline") importFrom("utils", "read.csv") importFrom("lattice", "xyplot") importFrom("Rdpack", "reprompt") diff -Nru r-cran-metap-1.6/NEWS r-cran-metap-1.7/NEWS --- r-cran-metap-1.6/NEWS 2021-10-27 13:59:24.000000000 +0000 +++ r-cran-metap-1.7/NEWS 2021-11-24 15:02:02.000000000 +0000 @@ -1,13 +1,20 @@ +Changes in version 1.7 + - updated data-set cholest + - added new data-set: zhang + - added log.p parameter to allmetap + - added new plotting function: albatros + - updated documentation + Changes in version 1.6 - updated documentation - added option to allow log inputs to selected functions - updated vignette - - added more information to data-sets + - added more information to data-sets validity and cholest Changes in version 1.5 - updated vignette - added option to return log p to selected functions - - combined all example data-sets into dat.metaps + - combined all example data-sets into dat.metap Changes in version 1.4 - fixed bug in votep (report by Wolfgang Viechtbauer) diff -Nru r-cran-metap-1.6/R/albatros.R r-cran-metap-1.7/R/albatros.R --- r-cran-metap-1.6/R/albatros.R 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-metap-1.7/R/albatros.R 2021-12-14 11:04:31.000000000 +0000 @@ -0,0 +1,92 @@ +albatros <- function(p, n, axes = list(xlimit = NULL, ylimit = NULL, + lefttext = NULL, righttext = NULL), + contours = list(type = NULL, contvals = NULL, ltys = NULL, contlabs = NULL), + plotpars = list(yscale = NULL, pchs = NULL, cols = NULL), ...) { + xtrans <- function(p) { + p2 <- ifelse(p > 0.5, 1 - p, p) + res <- log(1 / p2, base = 10) + res <- ifelse(p > 0.5, -res, res) + res + } + ytrans <- function(n) { + if(is.null(plotpars$yscale)) { + yscale <- "sqrt" + } else yscale <- plotpars$yscale + if(yscale == "classic") { + res <- log(n, base = 10) ^ 2 + } else if(yscale == "n") { + res <- n + } else if(yscale == "sqrt") { + res <- sqrt(n) + } else { + warning("Defaulting yscale to sqrt") + res <- sqrt(n) + } + res + } +# + if(length(p) != length(n)) { + stop(paste("p", length(p), " and n", length(n), "must be same length")) + } + keep <- (p < 1) & (p > 0) + validp <- p[keep] # remove zeroes and ones for axis calc + extreme <- min(min(validp), min(1 - validp)) +# set up axes + if(is.null(axes$xlimit)) { + xlims <- c(-xtrans(extreme), xtrans(extreme)) + } else { + xlims <- c(-xtrans(axes$xlimit), xtrans(axes$xlimit)) + } + if(is.null(axes$ylimit)) { + ylims <- c(ytrans(min(n)) * 0.9, ytrans(max(n)) * 1.1) + } else { + ylims <- c(ytrans(axes$ylimit[1]), ytrans(axes$ylimit[2])) + } +# + if(is.null(plotpars$pchs)) { + pchs <- rep(1, length(p)) + } else { + pchs <- plotpars$pchs + } + if(is.null(plotpars$cols)) { + cols <- rep("lightgrey", length(p)) + } else { + cols <- plotpars$cols + } + plot(xtrans(p), ytrans(n), + xlim = xlims, ylim = ylims, pch = pchs, + xaxt = "n", xlab = "p value", yaxt = "n", ylab = "N", ... + ) +# +# set up x-axis values and plot axis + sigs <- c(0.05, 0.01) + i <- 2 + while(sigs[i] > extreme) { + sigs[i+1] <- sigs[i] / 10 + i <- i + 1 + } + axis(1, at = c(-xtrans(sigs), 0, xtrans(sigs)), + labels = c(sigs, "null", sigs), cex.axis = 0.75, las = 3, + ...) +# set up y-axis values and plot axis + ylabs <- c(1, 2, 5) + maxn <- max(n) + i <- 3 + while(ylabs[i] < maxn) { + ylabs[i+1] <- ylabs[i - 2] * 10 + i <- i + 1 + } + axis(2, at = ytrans(ylabs), labels = ylabs, cex.axis = 0.75, + las = 2, ...) +# plot contours + docontours(contours$type, sigs, contours$contvals, xtrans, ytrans, + xlims, ylims, contours$ltys, contours$contlabs) + if(!is.null(axes$lefttext)) { + mtext(axes$lefttext, side = 1, line = 3, adj = 0) + } + if(!is.null(axes$righttext)) { + mtext(axes$righttext, side = 1, line = 3, adj = 1) + } + res <- list(xlims = xlims, ylims = ylims) + res +} diff -Nru r-cran-metap-1.6/R/allmetap.R r-cran-metap-1.7/R/allmetap.R --- r-cran-metap-1.6/R/allmetap.R 2018-07-25 12:14:44.000000000 +0000 +++ r-cran-metap-1.7/R/allmetap.R 2021-11-11 14:36:06.000000000 +0000 @@ -1,4 +1,4 @@ -allmetap <- function(p, method = NULL) { +allmetap <- function(p, method = NULL, log.p = FALSE) { if(is.null(method)) stop("Must specify a method") mydata <- '"funcs","eponyms" @@ -16,17 +16,28 @@ row.names(details) <- c("logitp", "maximump", "meanp", "meanz", "minimump", "sumlog", "sump", "sumz") close(con) +# now which have log.p as parameter +logpfuncs <- c("logitp", "meanz", "sumlog", "sumz") # if all specified reset funcnames funcnames <- method if("all" %in% method) funcnames <- row.names(details) # check all funcnames are valid functions keep <- funcnames %in% row.names(details) if(sum(keep * 1L) != length(funcnames)) warning("Some unsupported methods specified") -funcnames <- funcnames[keep] +if(log.p) { + keep2 <- funcnames %in% logpfuncs +} else { + keep2 <- keep +} +funcnames <- funcnames[keep2] if(length(funcnames) < 1) stop("No supported methods specified") helper <- function(x) { thisfunc <- match.fun(row.names(details[x,])) - res <- try(thisfunc(p), silent = TRUE) + if(log.p) { + res <- try(thisfunc(p, log.p = log.p), silent = TRUE) + } else { + res <- try(thisfunc(p), silent = TRUE) + } if(inherits(res, "try-error")) { res <- list(p = NA, valid = NA) } else { diff -Nru r-cran-metap-1.6/R/docontours.R r-cran-metap-1.7/R/docontours.R --- r-cran-metap-1.6/R/docontours.R 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-metap-1.7/R/docontours.R 2021-12-13 13:47:35.000000000 +0000 @@ -0,0 +1,63 @@ +docontours <- function(conttype, xvals, contvals, xtrans, ytrans, + xlims, ylims, ltys, contlabs) { +# + corr2n <- function(p, r) { + res <- qnorm(p) ^ 2 / atanh(r) ^ 2 + 3 + res + } +# + smd2n <- function(p, smd) { + res <- qnorm(p) ^ 2 * (8 + smd ^2) / (2 * smd ^ 2) + res + } +# + or2n <- function(p, or) { + lnor2 <- log(or) ^ 2 + res <- qnorm(p) ^ 2 * (8 * pi ^ 2 + 3 * lnor2) / (6 * lnor2) + res + } +# + valid <- TRUE + if(is.null(conttype)) { + valid <- FALSE + } else if(is.null(contvals)) { + valid <- FALSE + } else if(!conttype %in% c("smd", "or", "corr")) { + valid <- FALSE + warning(paste("Unrecognised effect type", conttype)) + } else if(conttype == "smd") { + contfunc <- smd2n + } else if(conttype == "corr") { + contfunc <- corr2n + } else if(conttype == "or") { + contfunc <- or2n + } + if(valid) { + pvals <- c(0.4, xvals) + l <- length(contvals) + if(is.null(ltys) | length(ltys != l)) { + ltys <- 1:l + } else if(length(ltys) == 1) { + ltys <- rep(ltys[1], l) + } + locallabs <- TRUE + if(!is.null(contlabs)) locallabs <- contlabs + for(i in 1:l) { + nvals <- contfunc(pvals, contvals[i]) + temp <- spline(xtrans(pvals), ytrans(nvals), n = 101) + # now find where it leaves plotting area + len <- length(temp$x) + if(locallabs) { + j <- 1 + while(temp$x[j] < xlims[2] & temp$y[j] < ylims[2] & j < len) { + j <- j + 1 + } + textx <- temp$x[j] + texty <- temp$y[j] + text(textx, texty, as.character(contvals[i]), pos = 2) + } + lines(temp, lty = ltys[i]) + lines(spline(-xtrans(pvals), ytrans(nvals), n = 101), lty = ltys[i]) + } + } +}