[R] Rolling regressions with sample extended one period at a time

R. Michael Weylandt michael.weylandt at gmail.com
Wed Mar 14 19:32:18 CET 2012

My apologies: I was thinking of "rolling" more in the sense of
"sliding" than "creeping". I'm not aware of anything suited for that,
but it's not hard to "roll your own" with something like

dats <- data.frame(x = 1:100, y = rnorm(100))

for(i in 80:100){
    lm(y ~ x, data = dats[1:i, ])


On Wed, Mar 14, 2012 at 10:38 AM, pie' <tcpietro at yahoo.it> wrote:
> Hi,
> I took a look at the documentation concerning rollapply and it doesnt seem
> to be the command I need. Just to be more clear, on an initial sample of 80
> observations I want to perform a probit regression and save the fitted
> probabilities in a vector. Subsequently another probit is run on the sample
> 1-81 with relative save of the fitted probabilities. And so again for the
> sample 1-82, 1-83, 1-84 etc... through the end of the sample. Does rollapply
> allow me to do this?
> P.
> --
> View this message in context: http://r.789695.n4.nabble.com/Rolling-regressions-with-sample-extended-one-period-at-a-time-tp4470316p4471995.html
> Sent from the R help mailing list archive at Nabble.com.
>        [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> 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.

More information about the R-help mailing list