get_p {POSSA}R Documentation

Extract p-value from tests

Description

This function attempts to extract p values from certain tests where it could otherwise be complicated to do so. Please make sure, in case of each new test, whether the function actually returns the values you want.

Usage

get_p(x)

## S3 method for class 'aov'
get_p(x)

## S3 method for class 'aovlist'
get_p(x)

Arguments

x

Test results.

Details

Supported functions: all tests that return the p value as p.value (including most R stats test functions, having htest class), and the aov() function (aov and aovlist classes).

Value

Returns either a single p value or, in case of multiple p values, a list or nested list with each p value.

Methods (by class)

Examples


get_p(t.test(extra ~ group, data = sleep))
# returns 0.07939414
# same as printed via t.test(extra ~ group, data = sleep)

get_p(prop.test(c(83, 90, 129, 70), c(86, 93, 136, 82)))
# returns 0.005585477,
# same as printed prop.test(c(83, 90, 129, 70), c(86, 93, 136, 82))

get_p(aov(yield ~ block + N * P * K, npk))
# returns list of p values
# corresponds to summary(aov(yield ~ block + N * P * K, npk))

get_p(aov(yield ~ N * P * K + Error(block), npk))
# returns nested list of p values (effects per error term)
# again corresponds printed p values via summary()


[Package POSSA version 0.6.4 Index]