Error when using fit(LinearModel,...) through GLM


#1

I want to perform a simple linear regression using this code:

fit(LinearModel, @formula(Y ~ t + t2 + t3), regdata)

I get the following error message:

MethodError: no method matching getindex(::DataFrames.DataFrame, ::DataArrays.DataArray{Any,1}, ::Colon)
#ModelFrame#124(::Dict{Any,Any}, ::Type{T} where T, ::DataFrames.Terms, ::DataFrames.DataFrame) at formula.jl:320
(::Core.#kw#Type)(::Array{Any,1}, ::Type{DataFrames.ModelFrame}, ::DataFrames.Terms, ::DataFrames.DataFrame) at <missing>:0
#ModelFrame#127(::Array{Any,1}, ::Type{T} where T, ::DataFrames.Formula, ::DataFrames.DataFrame) at formula.jl:333
(::Core.#kw#Type)(::Array{Any,1}, ::Type{DataFrames.ModelFrame}, ::DataFrames.Formula, ::DataFrames.DataFrame) at <missing>:0
#fit#153(::Dict{Any,Any}, ::Array{Any,1}, ::Function, ::Type{GLM.GeneralizedLinearModel}, ::DataFrames.Formula, ::DataFrames.DataFrame) at statsmodel.jl:52
#glm#17(::Array{Any,1}, ::Function, ::DataFrames.Formula, ::DataFrames.DataFrame) at glmfit.jl:317
glm(::DataFrames.Formula, ::DataFrames.DataFrame) at glmfit.jl:317
include_string(::String, ::String) at loading.jl:515
include_string(::String, ::String, ::Int64) at eval.jl:30
include_string(::Module, ::String, ::String, ::Int64, ::Vararg{Int64,N} where N) at eval.jl:34
(::Atom.##49#52{String,Int64,String})() at eval.jl:50
withpath(::Atom.##49#52{String,Int64,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
macro expansion at eval.jl:49 [inlined]
(::Atom.##48#51{Dict{String,Any}})() at task.jl:80

This is my matrix:

10×4 DataFrames.DataFrame
│ Row │ Y     │ t    │ t2      │ t3         │
├─────┼───────┼──────┼─────────┼────────────┤
│ 1   │ 82.21 │ 1981 │ 3924361 │ 7774159141 │
│ 2   │ 83.67 │ 1982 │ 3928324 │ 7785938168 │
│ 3   │ 84.8  │ 1983 │ 3932289 │ 7797729087 │
│ 4   │ 86.25 │ 1984 │ 3936256 │ 7809531904 │
│ 5   │ 88.08 │ 1985 │ 3940225 │ 7821346625 │
│ 6   │ 87.55 │ 1986 │ 3944196 │ 7833173256 │
│ 7   │ 88.45 │ 1987 │ 3948169 │ 7845011803 │
│ 8   │ 86.99 │ 1988 │ 3952144 │ 7856862272 │
│ 9   │ 86.3  │ 1989 │ 3956121 │ 7868724669 │
│ 10  │ 88.8  │ 1990 │ 3960100 │ 7880599000 │

Can somebody help me fix the problem? I do not quite understand the error message.