Okay thanks. Your MWE could have been:
using DataFrames, GLM
markers_visitors = Any[19, 34, 70, 122, 136, 105, 74, 14, 48, 81, 68, 91, 93, 55, 17, 44,
62, 61, 141, 65, 50, 104, 164, 152, 27, 54, 64, 60, 101, 53, 73]
markers_temp = Any[22.5, 23.5, 24.2, 22.1, 21.4, 20.6, 19.4, 19.8, 22.2, 22.7, 24.1,
24.1, 23.1, 21.9, 24.8, 26.2, 27.0, 23.5, 23.0, 21.5, 19.9, 28.4,
27.2, 24.8, 28.3, 29.7, 31.2, 30.0, 22.2, 31.0, 31.4]
df_new = DataFrame(visitors = markers_visitors, temp = markers_temp)
lm(@formula(visitors ~ temp), df_new)
This reproduces your error, and allows to narrow down the issue - it is indeed with the untyped Any
arrays, if you instead use:
markers_visitors = Int64[19, 34, 70, 122, 136, 105, 74, 14, 48, 81, 68, 91, 93, 55, 17, 44,
62, 61, 141, 65, 50, 104, 164, 152, 27, 54, 64, 60, 101, 53, 73]
markers_temp = Float64[22.5, 23.5, 24.2, 22.1, 21.4, 20.6, 19.4, 19.8, 22.2, 22.7, 24.1,
24.1, 23.1, 21.9, 24.8, 26.2, 27.0, 23.5, 23.0, 21.5, 19.9, 28.4,
27.2, 24.8, 28.3, 29.7, 31.2, 30.0, 22.2, 31.0, 31.4]
you should get:
visitors ~ 1 + temp
Coefficients:
─────────────────────────────────────────────────────────────────────────────
Estimate Std. Error t value Pr(>|t|) Lower 95% Upper 95%
─────────────────────────────────────────────────────────────────────────────
(Intercept) 89.0044 50.6897 1.75587 0.0897 -14.6677 192.676
temp -0.600152 2.04246 -0.293838 0.7710 -4.77745 3.57714
─────────────────────────────────────────────────────────────────────────────