Beispiel #1
0
func ExampleNewStrider() {
	data := statistics.Float64{
		.0421, .0941, .1064, .0242,
		.1331, .0773, .0243, .0815,
		.1186, .0356, .0728, .0999,
		.0614, .0479}
	strider := statistics.NewStrider(&data, 4)
	fmt.Printf("mean data is %.4f\n", statistics.Mean(&data))
	fmt.Printf("mean strider is %.4f\n", statistics.Mean(strider))
	// Output:
	// mean data is 0.0728
	// mean strider is 0.0979
}
Beispiel #2
0
// Find the mean number of views for a wikipedia page
func FindMeanViews(wr *WikiResponse) (mean int) {
	vals := GetValuesFromMap(wr.Yearly)
	mean = int(statistics.Mean(vals))
	return
}
Beispiel #3
0
func ExampleMean() {
	data := statistics.Float64{17.2, 18.1, 16.5, 18.3, 12.6}
	mean := statistics.Mean(&data)
	fmt.Printf("The sample mean is %g", mean)
	// Output: The sample mean is 16.54
}