September 2017
Beginner to intermediate
304 pages
7h 2m
English
There are many different test statistics that can be used in hypothesis testing. These include the Z-statistic, T-statistic, F-statistic, and chi-square statistic. You can, of course, implement these measures from scratch in Go without too much trouble. However, there are also some pre-existing implementations that you can use.
Returning to gonum.org/v1/gonum/stat, we can calculate a chi-square statistic as follows:
// Define observed and expected values. Most// of the time these will come from your// data (website visits, etc.).observed := []float64{48, 52}expected := []float64{50, 50}// Calculate the ChiSquare test statistic.chiSquare := stat.ChiSquare(observed, expected)
Read now
Unlock full access