Description Usage Arguments Details Examples
View source: R/computePValue.R
Function to approximate the p-value for augmented Dickey-Fuller test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | computePValue(object, ...)
## S3 method for class 'numeric'
computePValue(object, n, type = c("nc", "c", "ct"),
model = c("gam", "poly"), d = NULL, ...)
## S3 method for class 'fHTEST'
computePValue(object, model = c("gam", "poly"),
type = c("nc", "c", "ct"), d = NULL, ...)
## S3 method for class 'ur.df'
computePValue(object, model = c("gam", "poly"),
d = NULL, ...)
## S3 method for class 'htest'
computePValue(object, model = c("gam", "poly"),
d = NULL, ...)
|
object |
Numeric value or an object ( |
... |
Further arguments passed to methods. |
n |
Sample size. |
type |
The type of unit root test. Currently supports: |
model |
The model type to be used for approximation. Available is GAM
and polynomial regression. If |
d |
The degree for polynomial. |
Based on the chosen model (GAM or polynomial), the function returns the approximated p-value. Default is GAM model.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(pvurt)
y <- arima.sim(model = list(order = c(0, 1, 0)), n = 100)
# Test type: with drift and trend
# package: fUnitRoots
library(fUnitRoots)
computePValue(adfTest(y, lags = 3, type = "ct"))
computePValue(unitrootTest(y, lags = 3, type = "ct"))
# package: urca
library(urca)
computePValue(ur.df(y, lags = 3, type = "trend"))
# print summary
summary(computePValue(ur.df(y, lags = 3, type = "trend")))
# package: tseries
library(tseries)
computePValue(adf.test(y, alternative = "stationary", k = 3))
# no packages
tStat <- -2.239
sampleSize <- 100
computePValue(tStat, n = sampleSize, model = "gam", type = "ct")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.