https://github.com/alcortesm/sample
Utility functions for statistical population samples.
https://github.com/alcortesm/sample
confidence-interval confidence-intervals statistics
Last synced: 5 months ago
JSON representation
Utility functions for statistical population samples.
- Host: GitHub
- URL: https://github.com/alcortesm/sample
- Owner: alcortesm
- License: mit
- Created: 2015-12-26T12:50:05.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-08-24T14:34:52.000Z (almost 8 years ago)
- Last Synced: 2024-06-20T08:04:41.087Z (about 2 years ago)
- Topics: confidence-interval, confidence-intervals, statistics
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://godoc.org/github.com/alcortesm/sample)
[](https://travis-ci.org/alcortesm/sample)
[](https://codecov.io/github/alcortesm/sample?branch=master)
# Sample
Sample is a Go package to calculate useful values from samples of statistical
populations, including:
- the sample mean
- the sample-based unbiased estimation of the standard deviation of the
population
- the standard error of the mean
- the confidence intervals of the mean, assuming the samples comes from a Normal
distribution of unknown variance
The standard Go float64 type is used in all computations.
This package does *not* take advantage of multicore architectures.
## Import
```
import "github.com/alcortesm/sample"
```
## Examples
```Go
package main
import (
"fmt"
"log"
"github.com/alcortesm/sample"
)
func main() {
data := []float64{1.1, 0.9, 1.1, 1.3, 1.0}
// ignoring errors for demonstration purposes
mean, _ := sample.Mean(data)
fmt.Println(mean) // 1.08
sd, _ := sample.StandardDeviation(data)
fmt.Println(sd) // 0.15
se, _ := sample.StandardError(data)
fmt.Println(se) // 0.07
confidence := 0.95
ci, _ := sample.MeanConfidenceIntervals(data, confidence)
fmt.Printf("[%1.2f, %1.2f]\n", ci[0], ci[1]) // [0.90, 1.26]
}
```
## Author
- Alberto Cortés .
## License
This project is licensed under the MIT License - see the
[LICENSE](LICENSE) file for details.