-
Notifications
You must be signed in to change notification settings - Fork 10
bug theoretical wavelet variance AR1() #11
Description
Issue 1)
Reproduce this problem with the following code:
wv::ar1_to_wv(phi = -.5, sigma2 = 1, tau = 1:20)
Issue 2)
indeed observe that the theoretical and empirical wavelet variance do not match when the correct parameters are given as input to wv::ar1_to_wv.
Reproduce this problem with the following code:
y = gen_gts(model = AR1(phi = .7, sigma2 = 2), n = 100000)
mywv = wv::wvar(y)
plot(x = mywv$scales, mywv$variance, log = "xy", type ="b", col = "blue4")
wv_theo = wv::ar1_to_wv(phi = .7, sigma2 = 2, tau = 1:15)
lines(y= wv_theo, x = mywv$scales, col= "darkorange", type ="b")
Compare this to the following correct function where the wavelet is computing according to the SMAC Group website
perso_ar1_to_wv = function(phi, sigma2, tau){
all_tau = 2^tau
(sigma2*((phi^2-1)*all_tau + 2*phi*(phi^all_tau-4*phi^(all_tau/2)+3)) ) / ((phi-1)^3*(phi+1)*all_tau^2)
}