简体   繁体   中英

Linear regression using ff package

I am using ff package to do linear regression in R. Here tt is as.ffdf object. The code goes as follows:

> fit <- lm(ADA ~ DUMMY + NLEAD + BIG4 + LOGMKT + LEV + ROA + ROAL + LOSS +  
+                CFO + BTM + GROWTH + ALTMAN + ABSACCRL + 
+                STDEARN + TENURE + YEAR_FE , data = tt, weight = WEIGHT)

However, I am getting the following error:

Error: cannot allocate vector of size 2.0 Gb

How can I pre-create fit as a ff object, so that fit can absorb the entire data being returned to it? Thanks.

Can't check this on your data as you don't provide any. But this should get you running.

library(devtools)
install_github("edwindj/ffbase", subdir="pkg")

require(ffbase)
fit <- bigglm(ADA ~ DUMMY + NLEAD + BIG4 + LOGMKT + LEV + ROA + ROAL + LOSS +  
                CFO + BTM + GROWTH + ALTMAN + ABSACCRL + STDEARN + TENURE + YEAR_FE , 
              data = tt, family = gaussian(), weight = WEIGHT)

Or have a look at the example in the help of ?chunk.ffdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM