JuliaStats / GLM.jl

Generalized linear models in Julia
Other
593 stars 114 forks source link

Error in predict() with just a constant term #557

Open RobertGregg opened 5 months ago

RobertGregg commented 5 months ago
using GLM
using DataFrames

df1 = DataFrame(y = rand(10))
df2 = DataFrame(y = rand(10))

model = lm(@formula(y~1),df1)

y = predict(model,df2)

Gives the following error: ERROR: ArgumentError: collection must be non-empty

I realize this is a weird edge case, but I think it should just return mean(df1.y) for each prediction.