knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
This package has been created as part of my master thesis. The package has only one user facing function: computePVale(), which approximates p-value (cumulative probability) for augmented Dickey-Fuller unit root test based on the distribution of the test statistics. The approximation is based on pre-trained generalized additive logistic model or logistic regression with polynomial terms.
The function can take either a numeric value or the output from the four functions of the following three packages: adfTest() and unitrootTest() from fUnitRoots, adf.test() from tseries and, lastly, ur.df() from urca. If output from any of the function is passed on, computePVale() appends its approximation result to the original output.
The package has not been released in CRAN. To install use:
devtools::install_github("mlincon/pvurt")
Since the package must be complied, ensure that Rtools.exe is installed beforehand.
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.