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.
zcurve_data(data, id = NULL, rounded = TRUE, stat_precise = 2, p_precise = 3)a vector strings containing the test statistics.
a vector identifying observations from the same cluster.
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.
an integer specifying the numerical precision of
"z", "t", "f" statistics treated as exact values.
an integer specifying the numerical precision of p-values treated as exact values.
An object of type "zcurve_data".
By default, the function extract the type of test statistic:
"F(df1, df2)=x"F-statistic with df1 and df2 degrees of freedom,
"chi(df)=x"Chi-square statistic with df degrees of freedom,
"t(df)=x"for t-statistic with df degrees of freedom,
"z=x"for z-statistic,
"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.
# 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
#> Object of class z-curve data with 2 precise and 3 censored p-values.
#>
#> Precise p-values:
#> input p id
#> 1 t(34)=2.21 0.03393879 2
#> 2 p=0.003 0.00300000 5
#>
#> Censored p-values:
#> input p.lb p.ub p.rep id
#> 1 z=2.1 0.03155521 0.04036443 0.03572884 1
#> 2 p<0.03 0.00000000 0.03500000 0.03000000 3
#> 3 f(2,23)>10 0.00000000 0.15160840 0.15160840 4