Concise example of a basic linear regression in Julia, using GLM
and RDatasets
.
Reference:
using RDatasets, GLM
# List Datasets in the RDatasets julia library, in the "ISLR" package (there's lots more)
RDatasets.datasets("ISLR")
# RDatasets has a dataset() function to reads in a dataset from the catalog
auto = dataset("ISLR", "Auto");
first(auto, 5)
# Call GLM, note you just use the column names without any Str of Symbol stuff
ols = lm(@formula(MPG ~ Cylinders + Displacement), auto)