Hi everybody,
I am trying to replicate the formula shown in the attachment. I want to 
estimate tau using a macroeconomic variable X at month t using k lags of the 
variable X.
My code so far looks as follows:

psi <- fn(...)
k <- 1:K
ltau <- m + theta*sum(psi*X[t-k])

Unfortunately, if I run the code as shown the result I get is NA but I want to 
obtain a list of ltaus at month t.
ltau <- m + theta*sum(psi*X[t-k])
> ltau
[1] NA


Hence I defined t and ran X[t-k] and get following results. That is, X[t-k] 
provides every third element in my data table three times instead of 
calculating the sum of the lagged observations multiplied with psi

t<-1:15



> t

 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15

> X[t-k]

 [1] -0.25 -0.25 -0.25  0.50  0.50  0.50 -0.44 -0.44 -0.44  0.15  0.15  0.15

How do I get the list of taus at month t based on the sum of lagged 
observations as shown in the attachment?
Thanks in advance

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to