Commit b117d301 authored by MichelJuillard's avatar MichelJuillard
Browse files

removing obsolete code


Modified-by: MichelJuillard's avatarMichel Juillard <michel.juillard@mjui.fr>
parent 8cbc3a97
......@@ -822,78 +822,6 @@ function diffuse_kalman_likelihood(Y::Matrix{U},
LIK
end
#=
function univariate_step(t, Y, Z, H, T, QQ, a, Pinf, Pstar, diffuse_kalman_tol, kalman_tol, ws)
llik = 0
for i=1:size(Y, 1)
Zi = view(Z, i, :)
prediction_error = get_prediction_error(Y, Z, a, i, t)
Fstar = get_Fstar!(Zi, Pstar, H[i], ws.uKstar)
Finf = get_Finf!(Zi, Pstar, ws.uKstar)
# Conduct check of rank
# Pinf and Finf are always scaled such that their norm=1: Fstar/Pstar, instead,
# depends on the actual values of std errors in the model and can be badly scaled.
# experience is that diffuse_kalman_tol has to be bigger than kalman_tol, to ensure
# exiting the diffuse filter properly, avoiding tests that provide false non-zero rank for Pinf.
# Also the test for singularity is better set coarser for Finf than for Fstar for the same reason
if Finf > diffuse_kalman_tol # F_{\infty,t,i} = 0, use upper part of bracket on p. 175 DK (2012) for w_{t,i}
ws.Kinf_Finf .= ws.uKinf./Finf
a .+= prediction_error.*ws.Kinf_Finf
# Pstar = Pstar + Kinf*(Kinf_Finf'*(Fstar/Finf)) - Kstar*Kinf_Finf' - Kinf_Finf*Kstar'
ger!( Fstar/Finf, ws.uKinf, ws.Kinf_Finf, Pstar)
ger!( -1.0, ws.uKstar, ws.Kinf_Finf, Pstar)
ger!( -1.0, ws.Kinf_Finf, ws.uKstar, Pstar)
# Pinf = Pinf - Kinf*Kinf_Finf'
ger!(-1.0, ws.uKinf, ws.Kinf_Finf, Pinf)
llik += log(Finf)
elseif Fstar > kalman_tol
llik += log(Fstar) + prediction_error*prediction_error/Fstar
a .+= ws.uKstar.*(prediction_error/Fstar)
ger!(-1/Fstar, ws.uKstar, ws.uKstar, Pstar)
else
# do nothing as a_{t,i+1}=a_{t,i} and P_{t,i+1}=P_{t,i}, see
# p. 157, DK (2012)
end
end
return llik
end
function univariate_step(t, Y, Z, H, T, QQ, a, Pinf, Pstar, diffuse_kalman_tol, kalman_tol, pattern, ws)
llik = 0
for i=1:size(pattern, 1)
Zi = view(Z, pattern[i], :)
prediction_error = get_prediction_error(Y, Z, a, pattern[i], t)
Fstar = get_Fstar!(Zi, Pstar, H[i], ws.uKstar)
Finf = get_Finf!(Zi, Pstar, ws.uKstar)
# Conduct check of rank
# Pinf and Finf are always scaled such that their norm=1: Fstar/Pstar, instead,
# depends on the actual values of std errors in the model and can be badly scaled.
# experience is that diffuse_kalman_tol has to be bigger than kalman_tol, to ensure
# exiting the diffuse filter properly, avoiding tests that provide false non-zero rank for Pinf.
# Also the test for singularity is better set coarser for Finf than for Fstar for the same reason
if Finf > diffuse_kalman_tol # F_{\infty,t,i} = 0, use upper part of bracket on p. 175 DK (2012) for w_{t,i}
ws.Kinf_Finf .= ws.uKinf./Finf
a .+= prediction_error.*ws.Kinf_Finf
# Pstar = Pstar + Kinf*(Kinf_Finf'*(Fstar/Finf)) - Kstar*Kinf_Finf' - Kinf_Finf*Kstar'
ger!( Fstar/Finf, ws.uKinf, ws.Kinf_Finf, Pstar)
ger!( -1.0, ws.uKstar, ws.Kinf_Finf, Pstar)
ger!( -1.0, ws.Kinf_Finf, ws.uKstar, Pstar)
# Pinf = Pinf - Kinf*Kinf_Finf'
ger!(-1.0, ws.uKinf, ws.Kinf_Finf, Pinf)
llik += log(Finf)
elseif Fstar > kalman_tol
llik += log(Fstar) + prediction_error*prediction_error/Fstar
a .+= ws.uKstar.*(prediction_error/Fstar)
ger!(-1/Fstar, ws.uKstar, ws.uKstar, Pstar)
else
# do nothing as a_{t,i+1}=a_{t,i} and P_{t,i+1}=P_{t,i}, see
# p. 157, DK (2012)
end
end
return llik
end
=#
# Filters
function kalman_filter!(Y::AbstractArray{U},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment