Skip to content
Prev 333773 / 398506 Next

Automatic saving of many regression's output

Hi,
You may try something like:
set.seed(49)
dat1 <- as.data.frame(matrix(sample(1:300,41082*15,replace=TRUE),ncol=15)) #created only 15 columns as shown in your model
?dat1$indx <- as.numeric(gl(334*123,123,334*123))
names(dat1)[1] <- "rate"
?lst1 <- split(dat1[,-16],dat1[,16])
any(sapply(lst1,nrow)!=123)
#[1] FALSE
lst2 <- lapply(lst1,function(x) summary(lm(rate~.,data=x)))
?length(lst2)
#[1] 334


A.K.
On Wednesday, November 27, 2013 3:41 PM, nooldor <nooldor at gmail.com> wrote:
Thank you for reply.


OK.


you are right, let's make it more clear:

regressions would look like that:

summary(lm(rate~cap.log+liqamih.log+liqwol.log+pbv.log+mom.log+
???????????? +beta.wig+beta.wig.eq
?????????? +beta.sp
?????????? +beta.wig.macro
?????????? +beta.sp.macro
?????????? +beta.sentim.pl+beta.sentim.pl.ort
?????????? +beta.sentim.usa+beta.sentim.usa.ort, data=data))


the problem is how to make this lm() above for "rolling window" id est for first 334 observations? (total observations: 123*334). 
I need to run regresion_1 for first 334 observations, regression_2 for next 334 obs (from 335 to 669) and so on till regression_123 (from last 40748 till 41082).

And each time I run such regression I would like to save results (summary and mentioned tests).


Then I would like to repeat the same procedure but for rlm() and lmrob() if possible.


Hope it's better described now.
On 27 November 2013 21:24, arun <smartpink111 at yahoo.com> wrote:
So, if you have 49 dependent variables, what would be the model for one of the 123 regressions.
Message-ID: <1385587518.90142.YahooMailNeo@web142605.mail.bf1.yahoo.com>
In-Reply-To: <CAJ0Fr65F7sZ=FMmgyRzpx7eHyULheaAvL3r18dR2T-RkT=4Nrw@mail.gmail.com>