StatsModels.jl icon indicating copy to clipboard operation
StatsModels.jl copied to clipboard

Inconsistent intercepts between ModelFrame and apply_schema

Open GBarnsley opened this issue 1 year ago • 0 comments

Looks the interpretation of not specifying an intercept changes depending on whether you is ModelFrame or apply_schema, see the following code snippet

using StatsModels, DataFrames

f = @formula(y ~ x)

df = DataFrame(y = [1, 2, 3], x = [4, 5, 6])

mf = ModelFrame(f, df)
mf.f #has an intercept

apply_schema(f, schema(f, df)) #no intercept

Also since ModelFrame is not encouraged, it's a bit strange to have the categorical variable contrasts locked behind that function, unless there's a simple way to use them with apply_schema?

GBarnsley avatar Jun 11 '24 14:06 GBarnsley