Hi guys,

I am afraid I am stuck with an estimation problem.

I have two variables, X and Y. Y is explained by the weighted sum of n
lagged values of X. My aim is to estimate the two parameters
c(alpha0,alpha1) in:

Yt = Sum from j=1 to n of ( ( alpha0 + alpha1 * j ) * Xt-j )

Where Xt-j denotes the jth lag of X.

I came up with this approach because I thought it would be a good idea to
estimate the slope of the weights rather than estimating one parameter for
each lag of X added (I intent to set n very large). Is that easily doable
in R?

My first try looks like this:

    parameters<-function(alpha,y){
    logl<- for(i in 1:n){
    sum((alpha[1]+alpha[2]*i)*lag(xvar,i))
    }
    return(-logl)
    }
    optim(c(0.001,0.001),parameters,y=yvar)

It is really hard to find any clear sources when it comes to optimization
including lags.

I would really appreciate if someone could help me out on this one!

Kind regards & Happy Easter,

Christian

	[[alternative HTML version deleted]]

