Dear all: There seems to be a problem with scoping, for irf() in vars, when called within a function. Try the following: ----------------------- testfun <- function(lags){ data(Canada) var.2c <- VAR(Canada, p = lags, type = "const") print(var.2c) } testfun(lags=3) ## Everything OK. Now this: testfun2 <- function(lags){ data(Canada) var.2c <- VAR(Canada, p = lags, type = "const") itest <- irf(var.2c) plot(itest) } testfun2(lags=3) ## I get an error message: Error in VAR(y = ysampled, p = lags, type "const") (from #5) : ## object 'lags' not found. ------------------------- If you first assign lags and then define testfun2, it works. Seems to me like a scoping problem. Any ideas? Thanks! Toby -- Dr. Tobias M?hlhofer Assistant Professor Department of Finance Kelley School of Business Indiana University +1-812-855-9270 http://tobias.muhlhofer.com