study.with.derounding: Analysis with derounded z-statistics for different window...

Description Usage Arguments

View source: R/deround.R

Description

This is the main function you will call if you want to perform a publication bias / p-hacking analysis with derounded z-statistics. It allows flexible combinations of how a single derounded z vector is drawn, which statistics are computed for each combination of window h and derounded z-draw and how those statistics are aggregated over multiple replications.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
study.with.derounding(
  dat,
  h.seq = c(0.05, 0.075, 0.1, 0.2, 0.3, 0.4, 0.5),
  window.fun = window.t.ci,
  mode = c("reported", "uniform", "zda", "dsr")[1],
  alt.mode = c("uniform", "reported")[1],
  make.z.fun = NULL,
  z0 = ifelse(has.col(dat, "z0"), dat[["z0"]], 1.96),
  repl = 1,
  aggregate.fun = "median",
  ab.df = NULL,
  z.pdf = NULL,
  max.s = 100,
  common.deci = TRUE,
  verbose = TRUE
)

Arguments

dat

a data frame containing all observations. Each observation is a test from a regression table in some article. It must have the columns mu (reported coefficient) and sigma (reported standard error). The optional column no.deround can specify rows whose z statistic shall never be derounded. dat can also have the columns z, num.deci, mu.deci and sigma.deci. If those columns do not exist, they will be computed from mu and sigma.

h.seq

All considered half-window sizes

window.fun

The function that computes for each draw of a derounded z vector and a window h the statistics of interest. Examples are window.t.ci (DEFAULT) or window.binom.test. Not that our implementation of dsr derounding (or any other derounding using ab.df) does not draw derounded z, but only creates a logical vector above indicating which draws are above or below the z0 threshold. This means if you write a custom function, it should essentially work on that vector.

mode

Mode how a single draw of derounded z is computed: "reported", "uniform","zda","dsr" or some custom name (requires ab.df to be defined)

alt.mode

Either "uniform" (DEFAULT) or "reported". Some derounding modes like "zda" and "dsr" cannot be well defined (or are too time-consuming to compute) for observations with many significant digits or outlier z-statistics. alt.mode specifies how z values shall be selected for those observations.

z0

The significance threshold for z

repl

Number of replications of each derounding draw.

aggregate.fun

How shall multiple replications be aggregated. Not yet implemented. Currently we always take the medians of each variale returned by window.fun of all replications.

ab.df

Required if mode=="dsr" or some custom mode. See e.g. dsr.ab.df.

z.pdf

Required if mode=="zda". Should be generated via make.z.pdf.

max.s

Used if mode=="zda". Specifies the maximum significand for which zda derounding shall be performed. For observations with larger significand s, uniform derounding will be performed.

common.deci

Shall we assume that mu and sigma are given with the same number of decimal places. If TRUE (Default) take the column num.deci i present in dat or create it as the pairwise maximum of the decimal places of mu and sigma. If FALSE, either use the columns mu.deci and sigma.deci if present in dat or generate them from mu and sigma.


skranz/RoundingMatters documentation built on Dec. 23, 2021, 3:23 a.m.