ztable

package module
v0.0.0-...-41439b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 6 Imported by: 0

README

Normal Distribution Z-Score Table - Go

Generates a normal distribution z-score table in Go. Provides functions for quick z-score and percentage lookup.

Installing

To start using ztable, install Go and run go get:

$ go get -u github.com/gregscott94/z-table-golang

To Use

// Creating a new z-score table
zTable := NewZTable(nil)

// To find the percentage of a given z-score
percentage := zTable.FindPercentage(1.09)
// percentage = 0.8621434279679557

// To find the closest z-score given a percentage
zScore, err := zTable.FindZScore(0.04363)
// zScore = -1.71

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LeafNode

type LeafNode struct {
	// contains filtered or unexported fields
}

LeafNode struct

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node struct

type Options

type Options struct {
	BucketSize int // number of table values to group together in tree leaf-node
}

Options is a config for the NewZTable function which allows bucket size customization. Default bucket size is 30

type ZTable

type ZTable struct {
	// contains filtered or unexported fields
}

ZTable is the core z-score table component

func NewZTable

func NewZTable(options *Options) *ZTable

NewZTable creates and returns a new ZTable object. 'options' allows you to set the bucket size of the leaf nodes. Tuning bucket size will allow you to trade off memory for speed and vice-versa in the z-score lookup,

func (*ZTable) FindPercentage

func (zt *ZTable) FindPercentage(zScore float64) float64

FindPercentage returns the percentage of a given z-score from the table

func (*ZTable) FindZScore

func (zt *ZTable) FindZScore(percentage float64) (float64, error)

FindZScore returns the closest z-score given a percentage value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL