Home > OS >  adf test in Julia
adf test in Julia

Time:07-19

This is my FTSE column

enter image description here

To calculate log return of the FTSE; R code is given below.

log_return = diff(log(FTSE))*100

How to change it to JULIA further I need to do adf.test

 adf.test(log(FTSE))
  adf.test(log_return)

I had tried this

ADFTest(FTSE::AbstractVector{T}, deterministic::Symbol, lag::Int) where T<:Real

But I got an error.

in the same way I tried for this line

Box.test(log_return,lag=10,type = "Ljung-Box")

But error occurred.

Can anyone help me write the julia version of these, TIA

CodePudding user response:

I assume you want to use ADFTest from HypothesisTests.jl, here is how you should use it (I picked some example parameters for the test; this assumes you want to run a test for unit root in log returns of FTSE):

julia> using HypothesisTests

julia> FTSE = rand(20);

julia> log_return = diff(log.(FTSE));

julia> ADFTest(log_return, :none, 1)
Augmented Dickey-Fuller unit root test
--------------------------------------
Population details:
    parameter of interest:   coefficient on lagged non-differenced variable
    value under h_0:         0
    point estimate:          -2.23676

Test summary:
    outcome with 95% confidence: reject h_0
    p-value:                     <1e-06

Details:
    sample size in regression:          17
    number of lags:                     1
    ADF statistic:                      -5.27364
    Critical values at 1%, 5%, and 10%: [-2.69346 -1.95991 -1.60666]
  • Related