stats

package
v0.0.0-...-34cbb95 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

README

stats

Package stats contains functions and types to assist with the statistics analysis used in CABE. Please refer to Usage of R in CABE for more information.

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 BerfWilcoxonSignedRankedTestResult

type BerfWilcoxonSignedRankedTestResult 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
}

BerfWilcoxonSignedRankedTestResult is the result of a BerfWilcoxonSignedRankedTest.

func BerfWilcoxonSignedRankedTest

func BerfWilcoxonSignedRankedTest(x, y []float64, alt Hypothesis, transform DataTransform) (*BerfWilcoxonSignedRankedTestResult, error)

BerfWilcoxonSignedRankedTest conducts WilcoxonSignedRankedTest based on berf's use case. 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 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 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