I am currently working with a big dataset (n>10 million). I found fixest package very helpful to run logit fixed-effects models fast (feglm).
f1 <- feglm(result ~ log(rate1) +
sex +
age +
development +
pop +
acad +
size | state, se= "standard", family=c("logit"), lean =TRUE, mem.clean = TRUE, data=total)
The initial problem was that my models were too big. I've tried slimming them down with lean=TRUE
and mem.clean=TRUE
. I've also to wiped out the linear predictors and working residuals components of the model like so:
f1$linear.predictors <- NULL
f1$working_residuals <- NULL
By doing all these steps, I managed to trim A LOT of fat. The model was originally 1.2 GB but I managed to whip it down to ~200kb
print(object.size(f1), units = "auto")
218.3 Kb
Problems arise when I try to save the model as an rda file. The saving operation should take a split second. Instead, it takes minutes and saves the model as a bloated 300 MB file.
What am I doing wrong? I would like to keep the fixest object in its small 220 Kb size.
Thank you