Learn R Programming

power4mome (version 0.1.1)

summarize_tests: Summarize Test Results

Description

Extract and summarize test results.

Usage

summarize_tests(
  object,
  collapse = c("none", "all_sig", "at_least_one_sig", "at_least_k_sig"),
  at_least_k = 1
)

# S3 method for test_summary_list print(x, digits = 3, ...)

# S3 method for test_summary print(x, digits = 2, ...)

# S3 method for test_out_list print(x, digits = 3, test_long = FALSE, ...)

Value

The function summarize_tests() returns a list of the class test_summary_list. Each element contains a summary of a test stored. The elements are of the class test_summary, with these elements:

  • test_attributes: The stored information of a test, for printing.

  • nrep: The number of datasets (replications).

  • mean: The means of numeric information. For significance tests, these are the rejection rates.

  • nvalid: The number of non-NA replications used to compute each mean.

The print methods returns x invisibly. They are called for their side effects.

Arguments

object

A power4test object or the element test_all in a power4test object.

collapse

Whether a single decision (significant vs. not significant) is made across all tests for a test that consists of several tests (e.g., the tests of several parameters). If "none", tests will be summarized individually. If "all_sig", then the set of tests is considered significant if all individual tests are significant. If "at_least_one_sig", then the set of tests is considered significant if at least one of the tests is significant. If "at_least_k_sig", then the set of tests is considered significant if at least k tests are significant, k set by the argument at_least_k.

at_least_k

Used by collapse, the number of tests required to be significant for the set of tests to be considered significant.

x

The object to be printed.

digits

The numbers of digits after the decimal when printing numeric results.

...

Optional arguments. Not used.

test_long

If TRUE, a detailed report will be printed.

The role of <code>summarize_tests()</code> and related functions

The function summarize_tests() and related print methods are used by the all-in-one function power4test() and its summary method. Users usually do not call them directly, though developers can use this function to develop other functions for power analysis, or to build their own workflows to do the power analysis.

Details

The function summarize_tests() is used to extract information from each test stored in a power4test object.

The method print.test_out_list() is used to print the content of a list of test stored in a power4test object, with the option to print just the names of tests.

See Also

power4test()

Examples

Run this code

# Specify the model

mod <-
"
m ~ x
y ~ m + x
"

# Specify the population values

es <-
"
y ~ m: l
m ~ x: m
y ~ x: n
"

# Simulated datasets

sim_only <- power4test(nrep = 2,
                       model = mod,
                       pop_es = es,
                       n = 100,
                       do_the_test = FALSE,
                       iseed = 1234)

# Test the parameters in each dataset

test_out <- power4test(object = sim_only,
                       test_fun = test_parameters)

# Print the summary

summarize_tests(test_out)

Run the code above in your browser using DataLab