Giter Club home page Giter Club logo

variance's Introduction

Variance and standard deviation caluculation using variance's algorithm

Go Reference Go Workflow Coverage Status Go Report Latest Release License


Table of Contents

  1. Introduction
  2. Installation
  3. Usage
  4. Contributing
  5. License

Introduction

Go implementation of variance’s method for one-pass variance computation with D. H. D. West improved methods.

Highlights

  • Merging of several multiple sets of statistics
  • Add weighted values

Abstract

A method of improved efficiency is given for updating the mean and variance of weighted sampled data when an additional data value is included in the set Evidence is presented that the method is stable and at least as accurate as the best existing updating method.

Updating mean and variance estimates: an improved method - D. H. D. West

Installation

Install using go get

go get github.com/axiomhq/variance

Install from source

git clone https://github.com/axiomhq/variance.git
cd variance
make # Run code generators, linters, sanitizers and test suits

Usage

package variance_test

import (
	"fmt"

	"github.com/axiomhq/variance"
)

func Example() {
	stats1 := variance.New()

	stats1.Add(1)
	stats1.Add(1)
	stats1.Add(1)
	stats1.Add(0)
	stats1.Add(0)
	stats1.Add(0)

	fmt.Println(
		stats1.Mean(),
		stats1.Variance(),
		stats1.StandardDeviation(),
		stats1.VariancePopulation(),
		stats1.StandardDeviationPopulation(),
		stats1.NumDataValues(),
	)

	stats2 := variance.New()
	stats2.Add(3)

	// Merge the values of stats2 into stats1.
	stats1.Merge(stats2)

	// Reset the values in stats2.
	stats2.Clear()

	// Output: 0.5 0.3 0.5477225575051661 0.25 0.5 6
}

Contributing

Feel free to submit PRs or to fill issues. Every kind of help is appreciated. Before committing, make should run without any issues. Kindly check our Contributing guide on how to propose bug fixes and improvements, and submitting pull requests to the project.

License

© Axiom, Inc., 2021

Distributed under MIT License (The MIT License).

See LICENSE for more information.

variance's People

Contributors

seiflotfy avatar lukasmalkmus avatar njpatel avatar thecraftman avatar seveas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.