Relying on the contrasts can be potentially dangerous since the ordering of the levels and the levels themselves (and center for a CenteredTerm from StandardizedPredictors.jl) are determined from the data if not specified in the contrasts, so it's possible that you'd get different contrast coding if someone specified, e.g., contrasts=Dict(:x => EffectsCoding(), :y => Center()) and passed in a reference grid.
A better alternative is to match the Terms that are present in the 'effects formula' with a 'model formula' that was actually used to generate the modelcols for the model fit. Something like finding a matching terms based on StatsModels.symequal/termsyms.
Relying on the contrasts can be potentially dangerous since the ordering of the levels and the levels themselves (and center for a CenteredTerm from StandardizedPredictors.jl) are determined from the data if not specified in the contrasts, so it's possible that you'd get different contrast coding if someone specified, e.g.,
contrasts=Dict(:x => EffectsCoding(), :y => Center())
and passed in a reference grid.A better alternative is to match the Terms that are present in the 'effects formula' with a 'model formula' that was actually used to generate the modelcols for the model fit. Something like finding a matching terms based on
StatsModels.symequal
/termsyms
.