And so, now we're ready to build the regression model. Bear in mind that this section is highly iterative in real life. I will describe the iterations, but will only share the model that I chose to settle on.
The github.com/sajari/regression package does an admirable job. But we want to extend the package a little to be able to compare models and the coefficients of the parameters. So I wrote this function:
func runRegression(Xs [][]float64, Ys []float64, hdr []string) (r *regression.Regression, stdErr []float64) { r = new(regression.Regression) dp := make(regression.DataPoints, 0, len(Xs)) for i, h := range hdr { r.SetVar(i, h) } for i, row := range Xs { if i < 3 { log.Printf("Y %v Row %v", Ys[i], row) } dp = append(dp, regression.DataPoint(Ys[i], ...