FBartos/zcurve

add observed discovery rate to output

Closed this issue · 4 comments

Thanks for this very useful and well-made package.

The plot gives us the observed discovery rate, and a 95% CI - but as far as I can see, these numbers are not available in the results outputted by z-curve (not even when all = TRUE). To report results in R Markdown, it would be useful to have these numbers in the output of the z-curve function (maybe including the number of studies included in the analysis, and the number of significant results, also in the plot but not in the output.

Hi Daniel,

I'm glad that you like the package. I added information about the observed discovery rate (ODR) and the number of used, significant, and supplied z-statistics / p-values. It's located under the model convergence message for now. I'm still thinking about including ODR next to the estimates, however, it's not dependent on the estimated model (and it would break the output table if bootstrapping was disabled because the ODR CI is computed analytically.)

I will push this version to CRAN soon to make it directly available.

Cheers,
František

fit <- zcurve(rnorm(50,3)) summary(fit)

Call:
zcurve(z = rnorm(50, 3))

model: EM via EM

Estimate l.CI u.CI
ERR 0.859 0.726 0.940
EDR 0.858 0.222 0.940

Model converged in 29 + 73 iterations
Fitted using 41 z-values. 50 supplied, 41 significant (ODR = 0.82, 95% CI [0.68, 0.91]).
Q = -45.58, 95% CI[-49.23, -40.52]

1ceb2ae

Thanks - however, this does not solve the issue I raised - I would like to be able to get the value of ODR and report it in the text -so, z_res$fit$ODR would allow my to just get the number 0.82, and use it in a completely reproducible RMarkdown file. No rush, but in principle it is always useful to allow people to extract any calculated number from the stored result.

Oh, now I understand what you are after. Yeah, that's true. I added convenience functions for accessing all of the estimates (so you don't have to go directly into the z-curve object).

They either print the values into the console
ERR(fit)

Estimate l.CI u.CI
0.753 0.522 0.893

with a possibility to select formating
EDR(fit, 2)

Estimate l.CI u.CI
0.53 0.21 0.89

or directly access the raw values (using [["Estimate"]] / [["l.CI"]] / [["u.CI"]] or $Estimate / ..., apart from the significant_n and included_n which store the single value within [["n"]].

ODR(fit)[["Estimate"]]

0.82

ODR(fit)[["l.CI"]]

0.6807861

You can check ?estimates.zcurve for all the functions:
ERR(object, round.coef = 3)
EDR(object, round.coef = 3)
ODR(object, round.coef = 3)
Soric(object, round.coef = 3)
file_drawer_ration(object, round.coef = 3)
expected_n(object, round.coef = 0)
missing_n(object, round.coef = 0)
significant_n(object)
included_n(object)

Hope that this addresses the issue.
957745f

1.0.6 - version including this functionality is now on CRAN