Rscript -e 'x=1:10;p=2;Y=x[(p+1):length(x)];X==cbind(1,sapply(1:p,function(j)x[(p+1-j):(length(x)-j)])));print(X);print(summary(lm(Y~X-1)))'