p_value: Compute the P value

View source: R/p_value.R

p_valueR Documentation

Compute the P value

Description

Compute the P value of a cumulative distribution function (cdf).

Usage

p_value(cdf, x, paramet = numeric(0), side = 0)

Arguments

cdf

The cumulative distribution function. For normal distribution, cdf = pnorm.

x

A given value to compute the P value.

paramet

The parameter of the corresponding distribution. For normal distribution, paramet = c(mu, sigma).

side

A parameter indicating whether to compute one sided or two sided P value. When inputting side = -1 (or a number < 0), the function computes a left side P value; when inputting side = 1 (or a number > 0), the function computes a right side P value; when inputting side = 0 (default), the function computes a two sided P value.

Value

The P value.

Author(s)

Ying-Ying Zhang (Robert) robertzhangyying@qq.com

References

Zhang, Y. Y., Wei, Y. (2013), One and two samples using only an R funtion, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2991/asshm-13.2013.29")}.

Examples

p_value(pnorm, x = 0, side = 1)
p_value(pt, x = 0, paramet = 5, side = 1)

OneTwoSamples documentation built on March 31, 2023, 11:49 p.m.