There's more...
Implementing ordinary least squares is a good exercise, allowing you to learn how to implement it in Julia, but in practice you would not use this code directly (unless you have a very simple problem and do not want to introduce dependencies in your code). There are advanced packages allowing estimation of regression in the Julia ecosystem. The most popular one is https://github.com/JuliaStats/GLM.jl. It has a more advanced functionality, along with statistical inference.
Also, note that the df2mm function has two important special cases.
The first one is that it is possible that an array can contain only numbers, but can have some more general type. For instance, Any[1, 2, 3] would be considered by this function as a categorical ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access