pvalue: p-value Function

Description Usage Arguments Details Value References Examples

View source: R/pvalue.R

Description

Computes the p-value of the statistic by computing its rank compared to its simulated values.

Usage

1
pvalue(S0, S, type = c("geq", "leq", "absolute", "two-tailed"))

Arguments

S0

An atomic vector. Value of the test statistic applied to the data.

S

A vector. It consists of replications of the test statistic. S must have length greater than one.

type

A character string. It specifies the type of test the p-value function produces. The possible values are geq, leq, absolute and two-tailed. Default is geq.

Details

We allow for four types of p-value: leq, geq, absolute and two-tailed. For one-tailed test, leq returns the proportion of simulated values smaller than the statistic while geq returns the proportion of simulated values greater than the statistic. For two-tailed test with a symmetric satistic, one can use the absolute value of the statistic and its simulated values to retrieve a two-tailed test (i.e. type = absolute). If the statistic is not symmetric, one can specify the p-value type as two-tailed which is equivalent to twice the minimum of leq and geq.

Ties in the ranking are broken according to a uniform distribution.

Value

The p-value of the statistic S0 given a vector of replications S.

References

Dufour, J.-M. (2006), Monte Carlo Tests with nuisance parameters: A general approach to finite sample inference and nonstandard asymptotics in econometrics. Journal of Econometrics, 133(2), 443-447.

Dufour, J.-M. and Khalaf L. (2003), Monte Carlo Test Methods in Econometrics. in Badi H. Baltagi, ed., A Companion to Theoretical Econometrics, Blackwell Publishing Ltd, 494-519.

Examples

1
2
3
4
5
6
# Generate sample S0 and simulate statistics
S0 = 0
S = rnorm(99)

# Compute p-value
pvalue(S0, S, type = "geq")

julienneves/MMC documentation built on May 20, 2019, 4:22 a.m.