Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Linear ¶
Linear regression model:
y = a*x+b R^2 - the relative predictive power of a linear model
Example ¶
a, b, R2, err := Linear([][2]float64{ {2, 3}, {4, 7}, {6, 5}, {8, 10}, }) if err != nil { panic(err) } fmt.Fprintf(os.Stdout, "y = %.4f*x+%.4f\n", a, b) fmt.Fprintf(os.Stdout, "R^2 = %.4f\n", R2)
Output: y = 0.9500*x+1.5000 R^2 = 0.6748
func Quadratic ¶
Quadratic regression model:
y = a*x^2+b*x+c R^2 - the relative predictive power of a quadratic model
Example ¶
a, b, c, R2, err := Quadratic([][2]float64{ {-3.00, 7.50}, {-2.00, 3.00}, {-1.00, 0.50}, {+0.00, 1.00}, {+1.00, 3.00}, {+2.00, 6.00}, {+3.00, 14.0}, }) if err != nil { panic(err) } fmt.Fprintf(os.Stdout, "y = %.4f*x^2+%.4f*x+%.4f\n", a, b, c) fmt.Fprintf(os.Stdout, "R^2 = %.4f\n", R2)
Output: y = 1.1071*x^2+1.0000*x+0.5714 R^2 = 0.9884
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.