zcurve_data {zcurve}R Documentation

Prepare data for z-curve

Description

zcurve_data is used to prepare data for the zcurve() function. The function transform strings containing reported test statistics "z", "t", "f", "chi", "p" into two-sided p-values. Test statistics reported as inequalities are as considered to be censored as well as test statistics reported with low accuracy (i.e., rounded to too few decimals). See details for more information.

Usage

zcurve_data(data, id = NULL, rounded = TRUE, stat_precise = 2, p_precise = 3)

Arguments

data

a vector strings containing the test statistics.

id

a vector identifying observations from the same cluster.

rounded

an optional argument specifying whether de-rounding should be applied. Defaults to FALSE to treat all input as exact values or a numeric vector with values specifying precision of the input. The other option, FALSE, automatically extracts the number of decimals from input and treats the input as censored if it does not surpass the stat_precise and the p_precise thresholds.

stat_precise

an integer specifying the numerical precision of "z", "t", "f" statistics treated as exact values.

p_precise

an integer specifying the numerical precision of p-values treated as exact values.

Details

By default, the function extract the type of test statistic:

  1. "F(df1, df2)=x" for F-statistic with df1 and df2 degrees of freedom,

  2. "chi(df)=x" for chi-square statistic with df degrees of freedom,

  3. "t(df)=x" for t-statistic with df degrees of freedom,

  4. "z=x" for z-statistic,

  5. "p=x" for p-value.

The input is not case sensitive and automatically removes empty spaces. Furthermore, inequalities ("<" and ">") can be used to denote censoring. I.e., that the p-value is lower than "x" or that the test statistic is larger than "x" respectively. The automatic de-rounding procedure (if rounded = TRUE) treats p-values with less decimal places than specified in p_precise or test statistics with less decimal places than specified in stat_precise as censored on an interval that could result in a given rounded value. I.e., a "p = 0.03" input would be de-rounded as a p-value lower than 0.035 but larger than 0.025.

Value

An object of type "zcurve_data".

See Also

zcurve(), print.zcurve_data(), head.zcurve_data()

Examples

# Specify a character vector containing the test statistics
data <- c("z = 2.1", "t(34) = 2.21", "p < 0.03", "F(2,23) > 10", "p = 0.003")

# Obtain the z-curve data object
data <- zcurve_data(data)

# inspect the resulting object
data

[Package zcurve version 2.4.0 Index]