How to save glm result without data or only with coeffients for prediction?

后端 未结 4 416
后悔当初
后悔当初 2021-02-05 23:12

When I use the following R code,

model_glm=glm(V1~. , data=xx,family=\"binomial\");
save(file=\"modelfile\",model_glm);

The size of modelfile w

4条回答
  •  醉话见心
    2021-02-05 23:39

    Setting model = FALSE in your call to glm should prevent the model.frame from being returned. Also setting y = FALSE will prevent the response vector from being returned. x = FALSE is the default setting and prevents the model.matrix from being returned.

    This combination should shrink the size of your glm object.

    Of course, you can also extract the coefficients with coef(model_glm) or, with standard errors,

    summary(model_glm)$coef
    

提交回复
热议问题