kumulant

UnivariateRegressionResult

@Serializable
@SerialName(value = "UnivariateRegressionResult")
data class UnivariateRegressionResult(val penalty: Penalty, val totalWeights: Double, val slope: Double, val intercept: Double, val sse: Double, val sxy: Double, val x: VarianceResult, val y: VarianceResult) : Result, HasSlope, HasRegression(source)

Fitted univariate least-squares regression y = slope * x + intercept. Carries the marginal x / y variances and the raw weighted cross-deviation sxy so the result round-trips losslessly under merge regardless of penalty.

Constructors

Link copied to clipboard
constructor(penalty: Penalty, totalWeights: Double, slope: Double, intercept: Double, sse: Double, sxy: Double, x: VarianceResult, y: VarianceResult)

Properties

Link copied to clipboard
open override val bias: Double

Fitted bias / intercept term.

Link copied to clipboard

Pearson correlation derived from R^2 and the sign of sxy. Reuses sst/sse rather than storing the raw quantity.

Link copied to clipboard

Weighted covariance sxy / totalWeights.

Link copied to clipboard
open override val featureSize: Int

Number of features in weights.

Link copied to clipboard
open override val intercept: Double

Fitted intercept c.

Link copied to clipboard
open val mse: Double

Mean squared error: sse / totalWeights. Zero on an empty stream.

Link copied to clipboard
Link copied to clipboard
open val rmse: Double

Root mean squared error: sqrt([mse]).

Link copied to clipboard
open val rSquared: Double

Coefficient of determination 1 - sse/sst. Zero when sst is zero.

Link copied to clipboard

Unbiased sample standard deviation: sqrt([sampleVariance]).

Link copied to clipboard

Unbiased sample variance: [sst] / ([totalWeights] - 1). Zero when totalWeights <= 1.

Link copied to clipboard
open override val slope: Double

Fitted slope coefficient m.

Link copied to clipboard
open override val sse: Double

Sum of squared errors (residuals). Under non-identity GLMs this is the deviance.

Link copied to clipboard
open val ssr: Double

Sum of squares due to regression: sst - sse.

Link copied to clipboard
open override val sst: Double

Sum of squared deviations from the running mean: Sum (x - mean)^2 * weight.

Link copied to clipboard
open val stdDev: Double

Population standard deviation: sqrt([variance]).

Link copied to clipboard
val sxy: Double

Raw weighted cross-deviation Sum((x - meanX)(y - meanY) * w) from the underlying accumulator. Stored explicitly so merge round-trips losslessly even when slope has been soft-thresholded to zero or shrunk away from sxy / sxx.

Link copied to clipboard
open override val totalWeights: Double

Cumulative weight of observations folded into this result.

Link copied to clipboard
open val variance: Double

Population variance: [sst] / [totalWeights]. Zero on an empty stream.

Link copied to clipboard
open override val weights: VectorView

Fitted weight per feature, indexed by the same i as the input x[i].

Link copied to clipboard

Marginal statistics of the x stream.

Link copied to clipboard

Marginal statistics of the y stream.

Functions

Link copied to clipboard
open fun predict(x: VectorView): Double

Evaluate the linear predictor at x: bias + Sum_i weights[i] * x[i]. For Gaussian regression this is the prediction; for non-identity GLMs this is the linear predictor pre-link.

open fun predict(x: Double): Double

Evaluate the fitted line at x: slope * x + intercept.

UnivariateRegressionResult

constructor(penalty: Penalty, totalWeights: Double, slope: Double, intercept: Double, sse: Double, sxy: Double, x: VarianceResult, y: VarianceResult)(source)

correlation

Pearson correlation derived from R^2 and the sign of sxy. Reuses sst/sse rather than storing the raw quantity.

covariance

Weighted covariance sxy / totalWeights.

intercept

open override val intercept: Double(source)

Fitted intercept c.

penalty

slope

open override val slope: Double(source)

Fitted slope coefficient m.

sse

open override val sse: Double(source)

Sum of squared errors (residuals). Under non-identity GLMs this is the deviance.

sst

open override val sst: Double(source)

Sum of squared deviations from the running mean: Sum (x - mean)^2 * weight.

sxy

Raw weighted cross-deviation Sum((x - meanX)(y - meanY) * w) from the underlying accumulator. Stored explicitly so merge round-trips losslessly even when slope has been soft-thresholded to zero or shrunk away from sxy / sxx.

totalWeights

open override val totalWeights: Double(source)

Cumulative weight of observations folded into this result.

x

Marginal statistics of the x stream.

y

Marginal statistics of the y stream.