Grocer Function
NAME
filter - Kalman filter
CALLING SEQUENCE
[betat,betaf,sigmatt,sigmatf]=filter(param,func,y,x,F,z)
PARAMETERS
Input
-
param = a vector of parameters (sqrt of variances)
-
func = the function which transforms the parameters into the matrix of variances (Q and R) and, if necessary, into the matrices of prior values
-
y = (nx1) data vector
-
x = (nxk) data matrix
-
F = transition matrix
-
z = (nxl) data matrix
Output
-
betat = vector of filtered beta at date t with the information available at date t (beta(t|t))
- betaf = vector of filtered beta at date t with the information available at date t-1 (beta(t|t-1)
- ferror = vector of errors at date t (=y-x*beta(t|t))
-
sigmatt = vector of filtered variances at date t with the information available at date t (sigma(t|t))
- sigmatf = vector of filtered variances at date t with the information available at date t-1 (sigma(t|t-1))
DESCRIPTION
Generates model filtered betas and variance, given values for Q and R in a Kalman model:
y(t) = X(t)*B(t) + Z(t)*A + e(t), e(t) = N(0,R)
B(t) = Z(t)*B(t-1) + v(t), v(t) = N(0,Q)
EXAMPLE
Filter is used by the function kalman:
[betat,betaf,sigmatt,sigmatf]=filter(grocer_param,grocer_func,grocer_y,grocer_x,grocer_F)
AUTHOR
Eric Dubois 2002