Save and access residuals and fixed effects
mainBy default, the FixedEffectModel object is lightweight and does not store the original dataset or residuals. To access these, you must use the save option during estimation.
Options for save:
:none(default): Saves nothing.:residuals: Saves residuals.:fe: Saves fixed effects.:all: Saves both residuals and fixed effects.
Accessing Data:
Once saved, use the following functions. Note that predict and residuals require the original DataFrame as a second argument:
residuals(m, df)fe(m)(returns fixed effects)predict(m, df)
# To enable retrieval of residuals and fixed effects
m = reg(df, @formula(Sales ~ NDI + fe(State)), save = :all)
# Accessing them
res = residuals(m, df)
fixed_effects = fe(m)