stats

package
v0.0.0-...-e0ff526 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

README

stats

This package is a golang rewrite of the R implementation of the Wilcoxon test. This package also contains functions and types to assist with the statistics used in pairwise analysis. This package was originally written for CABE.

Please refer to Usage of R in CABE for more information and quantitative verification of the golang calculations against the R calculations.

Documentation

Index

Constants

View Source
const (
	// Less specifies the alternative hypothesis that the
	// location of the first sample is less than the second. This
	// is a one-tailed test.
	Less Hypothesis = -1

	// TwoSided specifies the alternative hypothesis that
	// the locations of the two samples are not equal. This is a
	// two-tailed test.
	TwoSided Hypothesis = 0

	// Greater specifies the alternative hypothesis that
	// the location of the first sample is greater than the
	// second. This is a one-tailed test.
	Greater Hypothesis = 1

	// LogTransform specifies the input of the wilcox test should be log transformed.
	// The resulting point estimate and the boundaries are delta percentage.
	LogTransform DataTransform = 0

	// NormalizeResult specifies the output of the wilcox test should be normalized by
	// dividing the median of the second input of the wilcox test. The point estimate and
	// the boundaries are delta percentage.
	NormalizeResult DataTransform = 1

	// OriginalResult specifies that we don't need to do additional processing of the
	// output of the wilcox test.
	OriginalResult DataTransform = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataTransform

type DataTransform int

A DataTransform specifies transform of the input/output of WilcoxonSignedRankedTest. The default (zero) value is to use the log transform.

type Hypothesis

type Hypothesis int

A Hypothesis specifies the alternative hypothesis of a location test such as a WilcoxonSignedRankedTest. The default (zero) value is to test against the alternative hypothesis that they differ.

type PairwiseWilcoxonSignedRankedTestResult

type PairwiseWilcoxonSignedRankedTestResult struct {
	// An estimate of the location parameter.
	Estimate float64

	// Lower boundary of the confidence interval.
	LowerCi float64

	// Upper boundary of the confidence interval.
	UpperCi float64

	// The p-value for the test
	PValue float64

	// The median of the first input. By convention, this is the treatment.
	XMedian float64

	// The median of the second input. By convention, this is the control.
	YMedian float64
}

PairwiseWilcoxonSignedRankedTestResult is the result of a PairwiseWilcoxonSignedRankedTest.

func PairwiseWilcoxonSignedRankedTest

func PairwiseWilcoxonSignedRankedTest(x, y []float64, alt Hypothesis, transform DataTransform) (PairwiseWilcoxonSignedRankedTestResult, error)

PairwiseWilcoxonSignedRankedTest conducts WilcoxonSignedRankedTest on Pinpoint's pairwise job. It performs a Wilcoxon signed rank test of the null that the distribution of x - y is symmetric about mu. y acts as baseline (control) and x acts as treatment. The resulting estimate/CI indicates % change relative to y when using LogTransform and NormalizeResult, and difference relative to y when using OriginalResult.

type WilcoxonSignedRankedTestResult

type WilcoxonSignedRankedTestResult struct {
	// An estimate of the location parameter.
	Estimate float64

	// Lower boundary of the confidence interval.
	LowerCi float64

	// Upper boundary of the confidence interval.
	UpperCi float64

	// The p-value for the test
	PValue float64
}

WilcoxonSignedRankedTestResult is the result of a WilcoxonSignedRankedTest.

func WilcoxonSignedRankedTest

func WilcoxonSignedRankedTest(x, y []float64, alt Hypothesis) (WilcoxonSignedRankedTestResult, error)

WilcoxonSignedRankedTest conducts WilcoxonSignedRankedTest based on R implementation.

Jump to

Keyboard shortcuts

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