[R] Fwd: Why does impulse response function of VAR starts at zero and not at one?

2013-07-24 Thread José Verhoeven
Hi there, I sent this e-mail two days ago, but I did not see it pass by the R-help mailinglist and I was wondering if you could post it or is there a que? Thanks in advance. Kind regards, Jose -- Forwarded message -- From: José Verhoeven Date: 2013/7/22 Subject: Why does

[R] Why does impulse response function of VAR starts at zero and not at one?

2013-07-22 Thread José Verhoeven
Hi there, I have estimated a bivariate VAR model (with series x1 and x2 as endogenous variables): y=cbind(x1,x2) z=cbind(d1,d2,d3,d4,d5,d6,d7,d8,d9) # some dummy variables model<-VAR(y, p = 3, type = c("const", "trend", "both", "none"), season = NULL, exogen = z, lag.max = NULL, ic = c("AIC

[R] estimating VAR(p) model leaving out intermediate lags

2013-05-29 Thread José Verhoeven
Hi, I would like to estimate a VAR(5) model, but including lags T-1, T-7, T-14, T-21 and T-28 instead of the usual T-1, T-2, T-3, T-4, T-5. But it seems I cannot accomplish this by using the below function. VAR(y, p = 1, type = c("const", "trend", "both", "none"), season = NULL, exogen = NULL, lag

Re: [R] Sum first 3 non zero elements of row

2013-05-21 Thread José Verhoeven
25, replace=T, prob=c(1/2,rep(1/8,4)), ncol=5) >> mat >> >> # [,1] [,2] [,3] [,4] [,5] >> #[1,]01243 >> #[2,]30010 >> #[3,]24404 >> #[4,]00000 >> #[5,]120

[R] Sum first 3 non zero elements of row

2013-05-21 Thread José Verhoeven
Hi there, I've got this matrix D with, say 10 rows and 20 columns. For each row I want to sum the first 3 non zero elements and put them in a vector z. So if the first row D[1,] is 0 3 5 0 8 9 3 2 4 0 then I want z z<-D[1,2]+D[1,3]+D[1,5] But if there are less than 3 non zero elements, those sho