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 |
stat_precise |
an integer specifying the numerical precision of
|
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:
"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.
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