Produces publication-ready tables with relevant statistics of interest for functions produced from the concurve package.
Dataframe from a concurve function to produce a table for
Levels of the consonance intervals or likelihood intervals
that should be included in the table. If NULL, the default, a
conventional set is used: 0.25, 0.50, 0.75, 0.80, 0.85, 0.90, 0.95, 0.975
and 0.99 for type = "c", and 0.03, 0.05, 0.12 and 0.14 for
type = "l". Values must match levels actually present in data, which
depends on the steps used to build it; any supplied level that matches
no row is omitted, with a warning naming it.
Indicates whether the table is for a consonance function or a
likelihood function. One of "c" for consonance, the default, or "l"
for likelihood.
The format of the table. One of "data.frame", the default,
"docx" (a table for a Word document), "pptx" (for PowerPoint),
"latex" (for a TeX document), or "image". An unrecognized type or
format is an error naming the permitted values.
The returned object depends on format:
"data.frame" (the default): a data frame of class
c("data.frame", "concurve") giving the interval limits and their
statistics at conventional levels, rounded to three digits.
"latex": a knitr_kable object for inclusion in a TeX document.
"image": a flextable object.
"docx" or "pptx": the result of printing the flextable to a
temporary Word or PowerPoint document.
curves <- curve_gen(lm(mpg ~ wt, data = mtcars), "wt")
# Interval limits at conventional levels, with their P- and S-values
curve_table(curves[[1]], format = "data.frame")
#> Lower Limit Upper Limit Interval Width Interval Level (%) CDF P-value
#> 250 -5.523 -5.166 0.356 25.0 0.625 0.750
#> 500 -5.722 -4.967 0.754 50.0 0.750 0.500
#> 750 -5.988 -4.701 1.286 75.0 0.875 0.250
#> 800 -6.061 -4.628 1.433 80.0 0.900 0.200
#> 850 -6.149 -4.540 1.610 85.0 0.925 0.150
#> 900 -6.264 -4.425 1.839 90.0 0.950 0.100
#> 950 -6.440 -4.249 2.192 95.0 0.975 0.050
#> 975 -6.598 -4.091 2.506 97.5 0.988 0.025
#> 990 -6.785 -3.904 2.880 99.0 0.995 0.010
#> S-value (bits)
#> 250 0.415
#> 500 1.000
#> 750 2.000
#> 800 2.322
#> 850 2.737
#> 900 3.322
#> 950 4.322
#> 975 5.322
#> 990 6.644
# Only the levels you ask for
curve_table(curves[[1]], levels = c(0.50, 0.95), format = "data.frame")
#> Lower Limit Upper Limit Interval Width Interval Level (%) CDF P-value
#> 500 -5.722 -4.967 0.754 50 0.750 0.50
#> 950 -6.440 -4.249 2.192 95 0.975 0.05
#> S-value (bits)
#> 500 1.000
#> 950 4.322
# The same table as LaTeX, for a manuscript
curve_table(curves[[1]], format = "latex")
#>
#>
#> | | Lower Limit| Upper Limit| Interval Width| Interval Level (%)| CDF| P-value| S-value (bits)|
#> |:---|-----------:|-----------:|--------------:|------------------:|-----:|-------:|--------------:|
#> |250 | -5.523| -5.166| 0.356| 25.0| 0.625| 0.750| 0.415|
#> |500 | -5.722| -4.967| 0.754| 50.0| 0.750| 0.500| 1.000|
#> |750 | -5.988| -4.701| 1.286| 75.0| 0.875| 0.250| 2.000|
#> |800 | -6.061| -4.628| 1.433| 80.0| 0.900| 0.200| 2.322|
#> |850 | -6.149| -4.540| 1.610| 85.0| 0.925| 0.150| 2.737|
#> |900 | -6.264| -4.425| 1.839| 90.0| 0.950| 0.100| 3.322|
#> |950 | -6.440| -4.249| 2.192| 95.0| 0.975| 0.050| 4.322|
#> |975 | -6.598| -4.091| 2.506| 97.5| 0.988| 0.025| 5.322|
#> |990 | -6.785| -3.904| 2.880| 99.0| 0.995| 0.010| 6.644|
# "docx", "pptx", and "image" return flextable objects for Word,
# PowerPoint, and figure output respectively.