using CSV,DataFrames,GLM,PrettyTables
d=CSV.File("test.csv")|>DataFrame
20×3 DataFrame
Row │ Column1 x yd
│ Int64 Int64 Float64
─────┼──────────────────────────
1 │ 1 1 29.6203
2 │ 2 2 45.885
3 │ 3 3 65.9141
4 │ 4 4 91.3283
5 │ 5 5 75.0673
6 │ 6 6 114.936
7 │ 7 7 128.787
8 │ 8 8 129.432
⋮ │ ⋮ ⋮ ⋮
14 │ 14 14 190.364
15 │ 15 15 217.794
16 │ 16 16 218.908
17 │ 17 17 239.705
18 │ 18 18 262.676
19 │ 19 19 250.201
20 │ 20 20 278.098
5 rows omitted
┌─────────┬───────┬─────────┐
│ Column1 │ x │ yd │
│ Int64 │ Int64 │ Float64 │
├─────────┼───────┼─────────┤
│ 1 │ 1 │ 29.6203 │
│ 2 │ 2 │ 45.885 │
│ 3 │ 3 │ 65.9141 │
│ 4 │ 4 │ 91.3283 │
│ 5 │ 5 │ 75.0673 │
│ 6 │ 6 │ 114.936 │
│ 7 │ 7 │ 128.787 │
│ 8 │ 8 │ 129.432 │
│ 9 │ 9 │ 140.165 │
│ 10 │ 10 │ 129.471 │
│ 11 │ 11 │ 147.239 │
│ 12 │ 12 │ 158.062 │
│ 13 │ 13 │ 190.481 │
│ 14 │ 14 │ 190.364 │
│ 15 │ 15 │ 217.794 │
│ 16 │ 16 │ 218.908 │
│ 17 │ 17 │ 239.705 │
│ 18 │ 18 │ 262.676 │
│ 19 │ 19 │ 250.201 │
│ 20 │ 20 │ 278.098 │
└─────────┴───────┴─────────┘
ols = lm(@formula(yd ~ x), d)
StatsModels.TableRegressionModel{LinearModel{GLM.LmResp{Vector{Float64}}, GLM.DensePredChol{Float64, CholeskyPivoted{Float64, Matrix{Float64}, Vector{Int64}}}}, Matrix{Float64}}
yd ~ 1 + x
Coefficients:
───────────────────────────────────────────────────────────────────────
Coef. Std. Error t Pr(>|t|) Lower 95% Upper 95%
───────────────────────────────────────────────────────────────────────
(Intercept) 25.8081 5.38511 4.79 0.0001 14.4944 37.1218
x 12.3237 0.449541 27.41 <1e-15 11.3792 13.2681
───────────────────────────────────────────────────────────────────────
# Print summary of the model
println(summary(ols))
StatsModels.TableRegressionModel{LinearModel{GLM.LmResp{Vector{Float64}}, GLM.DensePredChol{Float64, CholeskyPivoted{Float64, Matrix{Float64}, Vector{Int64}}}}, Matrix{Float64}}