Documentation
¶
Overview ¶
`stats` package provides functions for statistical analysis.
Index ¶
- func BartlettSphericity(dataTable insyra.IDataTable) (chiSquare float64, pValue float64, df int)
- func CalculateMoment(dl insyra.IDataList, n int, central bool) float64
- func CorrelationAnalysis(dataTable insyra.IDataTable, method CorrelationMethod) (corrMatrix *insyra.DataTable, pMatrix *insyra.DataTable, chiSquare float64, ...)
- func CorrelationMatrix(dataTable insyra.IDataTable, method CorrelationMethod) (corrMatrix *insyra.DataTable, pMatrix *insyra.DataTable)
- func Covariance(dlX, dlY insyra.IDataList) float64
- func Diag(x any, dims ...int) any
- func FactorPAFOblimin(corr *mat.Dense, numFactors int, delta float64, epsilon float64, maxIter int, ...) (*mat.Dense, *mat.Dense, *mat.Dense, *mat.Dense, *mat.Dense, []float64, ...)
- func Kurtosis(data any, method ...KurtosisMethod) float64
- func Skewness(sample any, method ...SkewnessMethod) float64
- type ANOVAResultComponent
- type AlternativeHypothesis
- type BartlettTestResult
- type ChiSquareTestResult
- type CorrelationMethod
- type CorrelationResult
- type EffectSizeEntry
- type ExponentialRegressionResult
- 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 FactorAnalysisOptions
- type FactorAnalysisResult
- type FactorCountMethod
- type FactorCountSpec
- type FactorExtractionMethod
- type FactorModel
- type FactorRotationMethod
- type FactorRotationOptions
- type FactorScoreMethod
- type KurtosisMethod
- type LinearRegressionResult
- type LogarithmicRegressionResult
- type OneWayANOVAResult
- type PCAResult
- type PolynomialRegressionResult
- type RepeatedMeasuresANOVAResult
- type SkewnessMethod
- type TTestResult
- type TwoWayANOVAResult
- type VarimaxAlgorithm
- type ZTestResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BartlettSphericity ¶ added in v0.2.2
func BartlettSphericity(dataTable insyra.IDataTable) (chiSquare float64, pValue float64, df int)
BartlettSphericity performs Bartlett's test of sphericity to assess the overall significance of the correlation matrix. dataTable: The DataTable containing the data to be tested. Returns the chi-square statistic, p-value, and degrees of freedom.
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 CorrelationAnalysis ¶ added in v0.2.2
func CorrelationAnalysis(dataTable insyra.IDataTable, method CorrelationMethod) (corrMatrix *insyra.DataTable, pMatrix *insyra.DataTable, chiSquare float64, pValue float64, df int)
CorrelationAnalysis provides a comprehensive correlation analysis. It calculates the correlation coefficient matrix, p-value matrix, and overall test (Bartlett's sphericity test) at once. Returns: correlation coefficient matrix, p-value matrix, chi-square value, p-value, degrees of freedom.
func CorrelationMatrix ¶ added in v0.2.2
func CorrelationMatrix(dataTable insyra.IDataTable, method CorrelationMethod) (corrMatrix *insyra.DataTable, pMatrix *insyra.DataTable)
CorrelationMatrix calculates the correlation coefficient matrix and its corresponding p-value matrix. dataTable: The DataTable used to compute the correlation matrix. method: The method used to calculate the correlation coefficient (Pearson, Kendall, or Spearman). Returns two DataTables: the first contains the correlation coefficient matrix, the second contains the p-value matrix.
func Covariance ¶ added in v0.0.4
func Diag ¶ added in v0.2.6
Diag creates a diagonal matrix or extracts the diagonal of a matrix.
If x is a matrix (*mat.Dense), it extracts the diagonal elements as a slice of float64. If x is a slice of float64, it creates a diagonal matrix with those elements. If x is an int, it creates an identity matrix of that size.
For creating diagonal matrices, nrow and ncol can be optionally specified to control the size. If not specified, it uses the length of the slice or the value of x.
Usage:
Diag(x) // Use default sizing Diag(x, nrow) // Specify nrow, ncol = nrow Diag(x, nrow, ncol) // Specify both nrow and ncol
This function mimics the behavior of R's diag function.
func FactorPAFOblimin ¶ added in v0.2.6
func FactorPAFOblimin(corr *mat.Dense, numFactors int, delta float64, epsilon float64, maxIter int, normalize float64) (*mat.Dense, *mat.Dense, *mat.Dense, *mat.Dense, *mat.Dense, []float64, []float64, int, bool, error)
FactorPAFOblimin performs PA-F Oblimin rotation (simplified implementation)
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 BartlettTestResult ¶ added in v0.2.6
type BartlettTestResult struct {
ChiSquare float64 // Chi-square statistic
DegreesOfFreedom int // Degrees of freedom
PValue float64 // P-value
SampleSize int // Sample size
}
BartlettTestResult contains the results of Bartlett's test of sphericity
type ChiSquareTestResult ¶ added in v0.0.6
type ChiSquareTestResult struct {
// a DataTable representing the contingency table([2]float64{observed, expected})
ContingencyTable *insyra.DataTable
// 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.
input: A DataList containing categorical data (e.g., ["A", "B", "A"]). p: Expected probabilities (e.g., []float64{0.5, 0.5}). If nil, assumes uniform distribution. rescaleP: Whether to rescale p to sum to 1.
func ChiSquareIndependenceTest ¶ added in v0.2.0
func ChiSquareIndependenceTest(rowData, colData insyra.IDataList) *ChiSquareTestResult
ChiSquareIndependenceTest performs a chi-square test of independence.
func (*ChiSquareTestResult) Show ¶ added in v0.2.6
func (r *ChiSquareTestResult) Show()
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
Correlation calculates the correlation between two IDataLists using the specified method. dlX: the first IDataList. dlY: the second IDataList. method: the method to use for calculating the correlation (Pearson, Kendall, or Spearman). Returns a CorrelationResult containing the correlation statistic, p-value, confidence interval, and degrees of freedom.
type EffectSizeEntry ¶ added in v0.2.0
type ExponentialRegressionResult ¶ added in v0.2.2
type ExponentialRegressionResult struct {
Intercept float64 // coefficient a in y = a·e^(b·x)
Slope float64 // coefficient b in y = a·e^(b·x)
Residuals []float64 // yᵢ − ŷᵢ
RSquared float64 // coefficient of determination
AdjustedRSquared float64 // adjusted R²
StandardErrorIntercept float64 // standard error of coefficient a
StandardErrorSlope float64 // standard error of coefficient b
TValueIntercept float64 // t statistic for coefficient a
TValueSlope float64 // t statistic for coefficient b
PValueIntercept float64 // p-value for coefficient a
PValueSlope float64 // p-value for coefficient b
// Confidence intervals for coefficients (95% by default)
ConfidenceIntervalIntercept [2]float64 // confidence interval for intercept [lower, upper]
ConfidenceIntervalSlope [2]float64 // confidence interval for slope [lower, upper]
}
ExponentialRegressionResult holds the result of exponential regression y = a·e^(b·x).
func ExponentialRegression ¶ added in v0.2.2
func ExponentialRegression(dlY, dlX insyra.IDataList) *ExponentialRegressionResult
--------------------------- Exponential ----------------------------------
y = a·e^{b·x}
** Verified using R **
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 FactorAnalysisOptions ¶ added in v0.2.6
type FactorAnalysisOptions struct {
Count FactorCountSpec
Extraction FactorExtractionMethod
Rotation FactorRotationOptions
Scoring FactorScoreMethod
MaxIter int // Optional: default 100
MinErr float64 // Optional: default 0.001 (R's min.err)
}
FactorAnalysisOptions contains all options for factor analysis
func DefaultFactorAnalysisOptions ¶ added in v0.2.6
func DefaultFactorAnalysisOptions() FactorAnalysisOptions
DefaultFactorAnalysisOptions returns default options for factor analysis. Defaults align with R's psych::fa function defaults.
type FactorAnalysisResult ¶ added in v0.2.6
type FactorAnalysisResult struct {
Loadings insyra.IDataTable // Loading matrix (variables × factors)
UnrotatedLoadings insyra.IDataTable // Unrotated loading matrix (variables × factors)
Structure insyra.IDataTable // Structure matrix (variables × factors)
Uniquenesses insyra.IDataTable // Uniqueness vector (p × 1)
Communalities insyra.IDataTable // Communality table (p × 1: Extraction)
SamplingAdequacy insyra.IDataTable // KMO overall index and per-variable MSA values
BartlettTest *BartlettTestResult // Bartlett's test of sphericity summary
Phi insyra.IDataTable // Factor correlation matrix (m × m), nil for orthogonal
RotationMatrix insyra.IDataTable // Rotation matrix (m × m), nil if no rotation
Eigenvalues insyra.IDataTable // Eigenvalues vector (p × 1)
ExplainedProportion insyra.IDataTable // Proportion explained by each factor (m × 1)
CumulativeProportion insyra.IDataTable // Cumulative proportion explained (m × 1)
Scores insyra.IDataTable // Factor scores (n × m), nil if not computed
ScoreCoefficients insyra.IDataTable // Factor score coefficient matrix (variables × factors)
ScoreCovariance insyra.IDataTable // Factor score covariance matrix (factors × factors)
Converged bool
RotationConverged bool
Iterations int
CountUsed int
Messages []string
}
FactorAnalysisResult contains the output of factor analysis
func (*FactorAnalysisResult) Show ¶ added in v0.2.6
func (r *FactorAnalysisResult) Show(startEndRange ...any)
Show prints everything in the FactorAnalysisResult
type FactorCountMethod ¶ added in v0.2.6
type FactorCountMethod string
FactorCountMethod defines the method for determining number of factors
const ( FactorCountFixed FactorCountMethod = "fixed" FactorCountKaiser FactorCountMethod = "kaiser" )
type FactorCountSpec ¶ added in v0.2.6
type FactorCountSpec struct {
Method FactorCountMethod
FixedK int // Optional: used when Method is CountFixed
EigenThreshold float64 // Optional: default 1.0 for CountKaiser
MaxFactors int // Optional: 0 means no limit
}
FactorCountSpec specifies how to determine the number of factors
type FactorExtractionMethod ¶ added in v0.2.6
type FactorExtractionMethod string
FactorExtractionMethod defines the method for extracting factors. See Docs/stats.md (Factor Analysis → Extraction Methods) for algorithmic details.
const ( FactorExtractionPCA FactorExtractionMethod = "pca" FactorExtractionPAF FactorExtractionMethod = "paf" FactorExtractionML FactorExtractionMethod = "ml" FactorExtractionMINRES FactorExtractionMethod = "minres" )
type FactorModel ¶ added in v0.2.6
type FactorModel struct {
FactorAnalysisResult
// contains filtered or unexported fields
}
FactorModel holds the factor analysis model
func FactorAnalysis ¶ added in v0.2.6
func FactorAnalysis(dt insyra.IDataTable, opt FactorAnalysisOptions) *FactorModel
FactorAnalysis performs factor analysis on a DataTable
type FactorRotationMethod ¶ added in v0.2.6
type FactorRotationMethod string
FactorRotationMethod defines the method for rotating factors. Rotation families and their properties are documented in Docs/stats.md.
const ( FactorRotationNone FactorRotationMethod = "none" FactorRotationVarimax FactorRotationMethod = "varimax" FactorRotationQuartimax FactorRotationMethod = "quartimax" FactorRotationQuartimin FactorRotationMethod = "quartimin" FactorRotationOblimin FactorRotationMethod = "oblimin" FactorRotationGeominT FactorRotationMethod = "geominT" FactorRotationBentlerT FactorRotationMethod = "bentlerT" FactorRotationSimplimax FactorRotationMethod = "simplimax" FactorRotationGeominQ FactorRotationMethod = "geominQ" FactorRotationBentlerQ FactorRotationMethod = "bentlerQ" FactorRotationPromax FactorRotationMethod = "promax" )
type FactorRotationOptions ¶ added in v0.2.6
type FactorRotationOptions struct {
Method FactorRotationMethod
Kappa float64 // Optional: Promax power (default 4)
Delta float64 // Optional: default 0 for Oblimin
Restarts int // Optional: random orthonormal starts for GPA rotations (default 10)
VarimaxAlgorithm VarimaxAlgorithm // Optional: "gparotation" (default) or "kaiser" (SPSS-compatible)
}
FactorRotationOptions specifies rotation parameters
type FactorScoreMethod ¶ added in v0.2.6
type FactorScoreMethod string
FactorScoreMethod defines the method for computing factor scores. Scoring equations and trade-offs are outlined in Docs/stats.md.
const ( FactorScoreNone FactorScoreMethod = "none" FactorScoreRegression FactorScoreMethod = "regression" FactorScoreBartlett FactorScoreMethod = "bartlett" FactorScoreAndersonRubin FactorScoreMethod = "anderson-rubin" )
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 // regression coefficient β₁ (for simple regression)
Intercept float64 // regression coefficient β₀ (for simple regression)
StandardError float64 // SE(β₁) - slope standard error (for simple regression)
StandardErrorIntercept float64 // SE(β₀) - intercept standard error (for simple regression)
TValue float64 // t statistic for β₁ (for simple regression)
TValueIntercept float64 // t statistic for β₀ (for simple regression)
PValue float64 // two-tailed p-value for β₁ (for simple regression)
PValueIntercept float64 // two-tailed p-value for β₀ (for simple regression)
// Legacy confidence intervals for simple regression compatibility
ConfidenceIntervalIntercept [2]float64 // 95% confidence interval for intercept [lower, upper]
ConfidenceIntervalSlope [2]float64 // 95% confidence interval for slope [lower, upper]
// Extended fields for multiple regression
Coefficients []float64 // [β₀, β₁, ..., βₚ] (intercept + slopes)
StandardErrors []float64 // standard errors for each coefficient
TValues []float64 // t statistics for each coefficient
PValues []float64 // two-tailed p-values for each coefficient
// Confidence intervals for coefficients (95% by default)
ConfidenceIntervals [][2]float64 // confidence intervals for each coefficient [lower, upper]
// Common fields
Residuals []float64 // yᵢ − ŷᵢ
RSquared float64 // coefficient of determination
AdjustedRSquared float64 // adjusted R²
}
LinearRegressionResult holds the result of both simple and multiple linear regression. For simple regression: Coefficients[0] = intercept, Coefficients[1] = slope For multiple regression: Coefficients[0] = intercept, Coefficients[1:] = slopes Comments are kept in English per project convention.
func LinearRegression ¶ added in v0.0.4
func LinearRegression(dlY insyra.IDataList, dlXs ...insyra.IDataList) *LinearRegressionResult
LinearRegression performs ordinary least-squares linear regression. Supports both simple (one X) and multiple (multiple X) linear regression. dlY is dependent variable, dlXs are independent variables (variadic).
** Verified using R **
type LogarithmicRegressionResult ¶ added in v0.2.2
type LogarithmicRegressionResult struct {
Intercept float64 // intercept coefficient in y = a + b·ln(x)
Slope float64 // slope coefficient in y = a + b·ln(x)
Residuals []float64 // yᵢ − ŷᵢ
RSquared float64 // coefficient of determination
AdjustedRSquared float64 // adjusted R²
StandardErrorIntercept float64 // standard error of coefficient a
StandardErrorSlope float64 // standard error of coefficient b
TValueIntercept float64 // t statistic for coefficient a
TValueSlope float64 // t statistic for coefficient b
PValueIntercept float64 // p-value for coefficient a
PValueSlope float64 // p-value for coefficient b
// Confidence intervals for coefficients (95% by default)
ConfidenceIntervalIntercept [2]float64 // confidence interval for intercept [lower, upper]
ConfidenceIntervalSlope [2]float64 // confidence interval for slope [lower, upper]
}
LogarithmicRegressionResult holds the result of logarithmic regression y = a + b·ln(x).
func LogarithmicRegression ¶ added in v0.2.2
func LogarithmicRegression(dlY, dlX insyra.IDataList) *LogarithmicRegressionResult
--------------------------- Logarithmic ---------------------------------- y = a + b·ln(x)
** Verified using R **
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 PolynomialRegressionResult ¶ added in v0.2.2
type PolynomialRegressionResult struct {
Coefficients []float64 // polynomial coefficients [a₀, a₁, a₂, ...]
Degree int // degree of polynomial
Residuals []float64 // yᵢ − ŷᵢ
RSquared float64 // coefficient of determination
AdjustedRSquared float64 // adjusted R²
StandardErrors []float64 // standard errors for each coefficient
TValues []float64 // t statistics for each coefficient
PValues []float64 // p-values for each coefficient
// Confidence intervals for coefficients (95% by default)
ConfidenceIntervals [][2]float64 // confidence intervals for each coefficient [lower, upper]
}
PolynomialRegressionResult holds the result of polynomial regression.
func PolynomialRegression ¶ added in v0.2.2
func PolynomialRegression(dlY, dlX insyra.IDataList, degree int) *PolynomialRegressionResult
--------------------------- Polynomial ----------------------------------- y = a₀ + a₁x + a₂x² + ... + aₙxⁿ
** Verified using R **
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
PairedTTest performs a paired-samples t-test comparing the means of two related groups. The data must be paired observations (same subjects measured twice). Parameters:
- data1, data2: The paired data groups to compare (must have same length)
- confidenceLevel: (Optional) Confidence level for the confidence interval (e.g., 0.95 for 95%, 0.99 for 99%) Must be between 0 and 1. If not provided or invalid, defaults to 0.95
** Verified using R **
func SingleSampleTTest ¶ added in v0.0.4
func SingleSampleTTest(data insyra.IDataList, mu float64, confidenceLevel ...float64) *TTestResult
SingleSampleTTest performs a one-sample t-test comparing the sample mean to a known population mean. Parameters:
- data: The sample data to test
- mu: The hypothesized population mean to compare against
- confidenceLevel: (Optional) Confidence level for the confidence interval (e.g., 0.95 for 95%, 0.99 for 99%) Must be between 0 and 1. If not provided or invalid, defaults to 0.95
** Verified using R **
func TwoSampleTTest ¶ added in v0.0.4
func TwoSampleTTest(data1, data2 insyra.IDataList, equalVariance bool, confidenceLevel ...float64) *TTestResult
TwoSampleTTest performs a two-sample t-test comparing the means of two independent groups. Parameters:
- data1, data2: The two data groups to compare
- equalVariance: Whether to assume equal variances between groups
- confidenceLevel: (Optional) Confidence level for the confidence interval (e.g., 0.95 for 95%, 0.99 for 99%) Must be between 0 and 1. If not provided or invalid, defaults to 0.95
** Verified using R **
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 VarimaxAlgorithm ¶ added in v0.2.6
type VarimaxAlgorithm string
VarimaxAlgorithm specifies which Varimax implementation to use
const ( VarimaxGPArotation VarimaxAlgorithm = "gparotation" // Gradient-based (matches R GPArotation) VarimaxKaiser VarimaxAlgorithm = "kaiser" // Jacobi rotation (matches SPSS) )
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