Dear list, I spent a lot of time looking for the solution for this problem, but with no success. It's the first time I came to the list to ask for help, so I'm sorry if I break some protocol. Well, I'm trying to make a serie of regressions in different periods, actually, in growing periods. In other words, I start by make a regression in a period from 1 to t, then I make another regression from 1 to t+1, and so on until t+1 < N. A loop version for this is: a <- rep(1,100)+rnorm(100) b <- rep(2,100)+rnorm(100) c <- rep(1.5,100)+rnorm(100) n.start <- 50 coefs <- array(NA,c(51,4)) for (i in (n.start:100)) coefs[i-n.start+1,] <- coef(lm(a ~ b + c, subset=1:i)) I want to avoid loops, so I was trying to make something like: regride <- function(formula,dat,sub,w) { window <- c(1:sub) w[1:sub-1] <- w[1:sub-1]*beta^sub coefs(lm(formula=formula,data=dat,subset=window,weights=w)) } coefs <- sapply(n_start:dim(ind)[1],regride,formula,dat,x) But it's not working. Best regards, Caio Casimiro -- Caio Ramos Casimiro Software Developer +55 11 9773 2809 [[alternative HTML version deleted]]