Closed palday closed 1 year ago
I think there are two types of effects that people might be interested in:
typical
values, in which case the magic is essentially in creating a model matrix where the excluded terms are filled by typical values. This is like effects
in the R world and should probably be the flagship effects()
functionality.vcov
. This approach is sometimes called "partial effects" and is what the remef
package in the R world does. If we omit the error term, then I would be tempted to call this partial_predict
or something similar.For (1), we need generate the model columns for higher-order terms from the typical values in the lowest-order terms and not using typical values of the higher-order terms in the original model matrix. Given this, @kleinschmidt and @ararslan have pointed out that it probably suffices to supply only the reference values for the effects and not a separate effects formula. Then we could have two methods, one taking a dictionary that is used to generate a fully crossed/balanced reference grid and one taking the reference grid directly for specifying particular combinations of the reference values. In both cases, the typical values and interaction columns would be added into the table before doing the effects computation.
I think we've had a working version of (1) for a while now.
For MixedModels, (2) is available from MixedModelsExtras. I don't think we want to support that level of functionality here because I'm not sure it's trivial to do in a way that works across many different model types. Additionally, with the support for by-term typical
functions (#48), it's possible for users to just pass a function that returns zero.
_Originally posted by @kleinschmidt in https://github.com/beacon-biosignals/Effects.jl/pull/1#discussion_r573833127_