zcurve {zcurve}R Documentation

Fit a z-curve

Description

zcurve is used to fit z-curve models. The function takes input of z-statistics or two-sided p-values and returns object of class "zcurve" that can be further interrogated by summary and plot function. It default to EM model, but different version of z-curves can be specified using the method and control arguments. See 'Examples' and 'Details' for more information.

Usage

zcurve(
  z,
  z.lb,
  z.ub,
  p,
  p.lb,
  p.ub,
  data,
  method = "EM",
  bootstrap = 1000,
  parallel = FALSE,
  control = NULL
)

Arguments

z

a vector of z-scores.

z.lb

a vector with start of censoring intervals of censored z-scores.

z.ub

a vector with end of censoring intervals of censored z-scores.

p

a vector of two-sided p-values, internally transformed to z-scores.

p.lb

a vector with start of censoring intervals of censored two-sided p-values.

p.ub

a vector with end of censoring intervals of censored two-sided p-values.

data

an object created with zcurve_data() function.

method

the method to be used for fitting. Possible options are Expectation Maximization "EM" and density "density", defaults to "EM".

bootstrap

the number of bootstraps for estimating CI. To skip bootstrap specify FALSE.

parallel

whether the bootstrap should be performed in parallel. Defaults to FALSE. The implementation is not completely stable and might cause a connection error.

control

additional options for the fitting algorithm more details in control EM or control density.

Details

The function returns the EM method by default and changing method = "density" gives the KD2 version of z-curve as outlined in Bartoš and Schimmack (2020). For the original z-curve (Brunner and Schimmack 2020), referred to as KD1, specify 'control = "density", control = list(model = "KD1")'.

Value

The fitted z-curve object

References

Bartoš F, Schimmack U (2020). “Z-curve. 2.0: Estimating Replication Rates and Discovery Rates.” doi:10.31219/osf.io/wr93f, submitted for publication.

Brunner J, Schimmack U (2020). “Estimating population mean power under conditions of heterogeneity and selection for significance.” Meta-Psychology, 4. doi:10.15626/MP.2018.874.

See Also

summary.zcurve(), plot.zcurve(), control_EM, control_density

Examples

# load data from OSC 2015 reproducibility project
OSC.z

# fit an EM z-curve (with disabled bootstrap due to examples times limits)
m.EM <- zcurve(OSC.z, method = "EM", bootstrap = FALSE)
# a version with 1000 boostraped samples would looked like:
m.EM <- zcurve(OSC.z, method = "EM", bootstrap = 1000)

# or KD2 z-curve (use larger bootstrap for real inference)
m.D <- zcurve(OSC.z, method = "density", bootstrap = FALSE)

# inspect the results
summary(m.EM)
summary(m.D)
# see '?summary.zcurve' for more output options

# plot the results
plot(m.EM)
plot(m.D)
# see '?plot.zcurve' for more plotting options

# to specify more options, set the control arguments
# ei. increase the maximum number of iterations and change alpha level
ctr1 <- list(
  "max_iter" = 9999,
  "alpha"    = .10
  )
## Not run: m1.EM <- zcurve(OSC.z, method = "EM", bootstrap = FALSE, control = ctr1)
# see '?control_EM' and '?control_density' for more information about different
# z-curves specifications

[Package zcurve version 2.4.2 Index]