Documentation
¶
Index ¶
- func CalculateMoment(dl insyra.IDataList, n int, central bool) float64
- func Covariance(dlX, dlY insyra.IDataList) float64
- func Kurtosis(data any, method ...KurtosisMethod) float64
- func Skewness(sample any, method ...SkewnessMethod) float64
- type ANOVAResultComponent
- type AlternativeHypothesis
- type ChiSquareTestResult
- type CorrelationMethod
- type CorrelationResult
- type EffectSizeEntry
- type FTestResult
- func BartlettTest(groups []insyra.IDataList) *FTestResult
- func FTestForNestedModels(rssReduced, rssFull float64, dfReduced, dfFull int) *FTestResult
- func FTestForRegression(ssr, sse float64, df1, df2 int) *FTestResult
- func FTestForVarianceEquality(data1, data2 insyra.IDataList) *FTestResult
- func LeveneTest(groups []insyra.IDataList) *FTestResult
- type KurtosisMethod
- type LinearRegressionResult
- type OneWayANOVAResult
- type PCAResult
- type RepeatedMeasuresANOVAResult
- type SkewnessMethod
- type TTestResult
- type TwoWayANOVAResult
- type ZTestResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateMoment ¶ added in v0.0.3
CalculateMoment calculates the n-th moment of the DataList. If central is true, it computes the central moment; otherwise, raw moment. Returns NaN if the DataList is empty or the moment cannot be calculated.
func Covariance ¶ added in v0.0.4
func Kurtosis ¶
func Kurtosis(data any, method ...KurtosisMethod) float64
Kurtosis calculates the kurtosis of the DataList. method: 1 = g2, 2 = adjusted Fisher kurtosis, 3 = bias-adjusted. Default is KurtosisG2. Returns NaN if the data is empty or undefined.
func Skewness ¶ added in v0.0.3
func Skewness(sample any, method ...SkewnessMethod) float64
Skewness calculates the skewness of a sample using the specified method.
method default: SkewnessG1(type 1)。
Types ¶
type ANOVAResultComponent ¶ added in v0.2.0
type AlternativeHypothesis ¶ added in v0.2.0
type AlternativeHypothesis string
const ( TwoSided AlternativeHypothesis = "two-sided" Greater AlternativeHypothesis = "greater" Less AlternativeHypothesis = "less" )
type ChiSquareTestResult ¶ added in v0.0.6
type ChiSquareTestResult struct {
// contains filtered or unexported fields
}
func ChiSquareGoodnessOfFit ¶ added in v0.2.0
func ChiSquareGoodnessOfFit(input insyra.IDataList, p []float64, rescaleP bool) *ChiSquareTestResult
ChiSquareGoodnessOfFit performs a one-dimensional chi-square goodness of fit test.
func ChiSquareIndependenceTest ¶ added in v0.2.0
func ChiSquareIndependenceTest(rowData, colData insyra.IDataList) *ChiSquareTestResult
ChiSquareIndependenceTest performs a chi-square test of independence.
type CorrelationMethod ¶ added in v0.0.4
type CorrelationMethod int
CorrelationMethod 定義了相關係數的計算方法
const ( PearsonCorrelation CorrelationMethod = iota KendallCorrelation SpearmanCorrelation )
type CorrelationResult ¶ added in v0.2.0
type CorrelationResult struct {
// contains filtered or unexported fields
}
func Correlation ¶ added in v0.0.4
func Correlation(dlX, dlY insyra.IDataList, method CorrelationMethod) *CorrelationResult
type EffectSizeEntry ¶ added in v0.2.0
type FTestResult ¶ added in v0.0.6
type FTestResult struct {
DF2 float64 // degree of freedom for the second group
// contains filtered or unexported fields
}
func BartlettTest ¶ added in v0.2.0
func BartlettTest(groups []insyra.IDataList) *FTestResult
BartlettTest performs Bartlett's test for equality of variances. Input: slice of *insyra.DataList, each representing a group.
func FTestForNestedModels ¶ added in v0.2.0
func FTestForNestedModels(rssReduced, rssFull float64, dfReduced, dfFull int) *FTestResult
FTestForNestedModels compares two nested regression models. rssReduced: residual sum of squares of reduced model rssFull: residual sum of squares of full model dfReduced, dfFull: degrees of freedom of both models
func FTestForRegression ¶ added in v0.2.0
func FTestForRegression(ssr, sse float64, df1, df2 int) *FTestResult
FTestForRegression performs an overall F-test for a regression model. ssr: regression sum of squares sse: error sum of squares df1: degrees of freedom for the model (number of predictors) df2: degrees of freedom for residuals (n - k - 1)
func FTestForVarianceEquality ¶ added in v0.0.6
func FTestForVarianceEquality(data1, data2 insyra.IDataList) *FTestResult
FTestForVarianceEquality performs an F-test for variance equality
func LeveneTest ¶ added in v0.2.0
func LeveneTest(groups []insyra.IDataList) *FTestResult
LeveneTest performs Levene's Test for equality of variances across multiple groups. Input: slice of *insyra.DataList, each representing a group. Output: *FTestResult
type KurtosisMethod ¶ added in v0.2.0
type KurtosisMethod int
KurtosisMethod defines available kurtosis calculation methods.
const ( KurtosisG2 KurtosisMethod = iota + 1 // Type 1: g2 (default) KurtosisAdjusted // Type 2: adjusted Fisher kurtosis KurtosisBiasAdjusted // Type 3: bias-adjusted )
type LinearRegressionResult ¶ added in v0.0.4
type LinearRegressionResult struct {
Slope float64 // 斜率
Intercept float64 // 截距
Residuals []float64 // 殘差
RSquared float64 // R-squared
AdjustedRSquared float64 // 調整後的 R-squared
StandardError float64 // 標準誤差
TValue float64 // t 值
PValue float64 // p 值
}
LinearRegressionResult holds the result of a linear regression, including slope, intercept, and other statistical details.
func LinearRegression ¶ added in v0.0.4
func LinearRegression(dlX, dlY insyra.IDataList) *LinearRegressionResult
LinearRegression performs simple linear regression on two datasets (X and Y). It returns the slope, intercept, residuals, R-squared, and other statistical details.
type OneWayANOVAResult ¶ added in v0.0.7
type OneWayANOVAResult struct {
Factor ANOVAResultComponent
Within ANOVAResultComponent
TotalSS float64
}
func OneWayANOVA ¶ added in v0.0.6
func OneWayANOVA(groups ...insyra.IDataList) *OneWayANOVAResult
type PCAResult ¶ added in v0.0.8
type PCAResult struct {
Components insyra.IDataTable // 主成分存為 DataTable
Eigenvalues []float64 // 對應的特徵值
ExplainedVariance []float64 // 每個主成分解釋的變異百分比
}
PCAResult contains the results of a Principal Component Analysis.
func PCA ¶ added in v0.0.8
func PCA(dataTable insyra.IDataTable, nComponents ...int) *PCAResult
PCA calculates the Principal Component Analysis of a DataTable. The function returns a PCAResult struct containing the principal components, eigenvalues, and explained variance. The number of components to extract can be specified using the nComponents parameter. If nComponents is not specified or exceeds the number of columns, all components will be extracted.
type RepeatedMeasuresANOVAResult ¶ added in v0.0.8
type RepeatedMeasuresANOVAResult struct {
Factor ANOVAResultComponent
Subject ANOVAResultComponent
Within ANOVAResultComponent
TotalSS float64
}
func RepeatedMeasuresANOVA ¶ added in v0.2.0
func RepeatedMeasuresANOVA(subjects ...insyra.IDataList) *RepeatedMeasuresANOVAResult
type SkewnessMethod ¶ added in v0.2.0
type SkewnessMethod int
SkewnessMethod defines available skewness calculation methods.
const ( SkewnessG1 SkewnessMethod = iota + 1 // Type 1: G1 (default) SkewnessAdjusted // Type 2: Adjusted Fisher-Pearson SkewnessBiasAdjusted // Type 3: Bias-adjusted )
type TTestResult ¶ added in v0.0.4
type TTestResult struct {
Mean *float64 // mean of the first group (or the only group)
Mean2 *float64 // mean of the second group (nil if not applicable)
MeanDiff *float64 // mean difference (only for paired t-test)
N int // sample size of the first group (or the only group or paired group)
N2 *int // sample size of the second group (nil if not applicable)
// contains filtered or unexported fields
}
func PairedTTest ¶ added in v0.0.4
func PairedTTest(data1, data2 insyra.IDataList, confidenceLevel float64) *TTestResult
func SingleSampleTTest ¶ added in v0.0.4
func SingleSampleTTest(data insyra.IDataList, mu float64, confidenceLevel float64) *TTestResult
func TwoSampleTTest ¶ added in v0.0.4
func TwoSampleTTest(data1, data2 insyra.IDataList, equalVariance bool, confidenceLevel float64) *TTestResult
type TwoWayANOVAResult ¶ added in v0.0.7
type TwoWayANOVAResult struct {
FactorA ANOVAResultComponent
FactorB ANOVAResultComponent
Interaction ANOVAResultComponent
Within ANOVAResultComponent
TotalSS float64
}
func TwoWayANOVA ¶ added in v0.2.0
func TwoWayANOVA(factorALevels, factorBLevels int, cells ...insyra.IDataList) *TwoWayANOVAResult
type ZTestResult ¶ added in v0.2.0
type ZTestResult struct {
Mean float64 // mean of the first group (or the only group)
Mean2 *float64 // mean of the second group (nil if not applicable)
N int // sample size of the first group (or the only group)
N2 *int // sample size of the second group (nil if not applicable)
// contains filtered or unexported fields
}
func SingleSampleZTest ¶ added in v0.2.0
func SingleSampleZTest(data insyra.IDataList, mu float64, sigma float64, alternative AlternativeHypothesis, confidenceLevel float64) *ZTestResult
func TwoSampleZTest ¶ added in v0.2.0
func TwoSampleZTest(data1, data2 insyra.IDataList, sigma1, sigma2 float64, alternative AlternativeHypothesis, confidenceLevel float64) *ZTestResult