`x`

(equivalently, `x`

is a non-stationary time series).`pp.test(x, type = c("Z_rho", "Z_tau"), lag.short = TRUE, output = TRUE)`

x

a numeric vector or univariate time series.

type

the type of Phillips-Perron test. The default is

`Z_rho`

.lag.short

a logical value indicating whether the parameter of lag to calculate the
statistic is a short or long term. The default is a short term.

output

a logical value indicating to print the results in R console. The default
is

`TRUE`

.- A matrix for test results with three columns (
`lag`

,`Z_rho`

or`Z_tau`

,`p.value`

) and three rows (`type1`

,`type2`

,`type3`

). Each row is the test results (including lag parameter, test statistic and p.value) for each type of linear equation.

`ADF`

. The calculations of each type
of the Phillips-Perron test can be see in the reference below. If the
`lag.short = TRUE`

, we use the default number of Newey-West lags
$floor(4*(length(x)/100)^0.25)$,
otherwise $floor(12*(length(x)/100)^0.25)$ to calculate the test statistics.
In order to calculate the test statistic, we consider
three types of linear regression models. The first type (`type1`

) is the one
with no drift and linear trend with respect to time:
$$x[t] = \rho*x[t-1] + e[t],$$
where $e[t]$ is an error term.
The second type (`type2`

) is the one with drift but no linear trend:
$$x[t] = \mu + \rho*x[t-1] + e[t].$$
The third type (type3) is the one with both drift and linear trend:
$$x[t] = \mu + \alpha*t + \rho*x[t-1] + e[t].$$
The p.value is calculated by the interpolation of test statistics from the critical values
tables (Table 10.A.1 for `Z_rho`

and 10.A.2 for `Z_tau`

in Fuller (1996))
with a given sample size $n$ = length(`x`

).Fuller, W. A. (1996). Introduction to statistical time series, second ed., Wiley, New York.

`adf.test`

, `kpss.test`

, `stationary.test`

```
# PP test for ar(1) process
x <- arima.sim(list(order = c(1,0,0),ar = 0.2),n = 100)
pp.test(x)
# PP test for co2 data
pp.test(co2)
```

Run the code above in your browser using DataCamp Workspace