Saving LinearModel without data

My question:

How can I save the results of a regression (say a LinearModel from GLM.jl) without the data that are stored inside the object?

Context:

I run several regressions using GLM.jl. At some point after all the results are in, some of the regressions are combined into tables (perhaps using RegressionTables.jl). Until I know exactly how I want to display the results, I want to store the each regression in a file.

Options:

  1. Delete the data inside the LinearModel object.
    Drawback: this would depend on the undocumented internal structure of the object, which could change at any time.
  2. Save only the information that I want to display in a custom object.
    Drawback: RegressionTables.jl (and probably other packages) expect a LinearModel as input. So I would not be able to use those.

Are there better options?

Also searching this. Do you have a solution now?

I would think OP decided between his two options, 1. being quick & dirty and 2. being able to adapt to changing internal representations over different versions of the package?

I went with option 2, but have not checked recently whether there is now an “official” solution.

1 Like