beacon-biosignals / Effects.jl

Effects Prediction for Regression Models
MIT License
19 stars 4 forks source link

Rely on template formula instead of contrasts #16

Closed kleinschmidt closed 3 years ago

kleinschmidt commented 3 years ago

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.

palday commented 3 years ago

Closed by #19