Skip to main content

module analysis::statistics::SimpleRegression

rascal-0.34.0

Statistical methods for simple regression.

Usage

import analysis::statistics::SimpleRegression;

Dependencies

import Exception;

Description

The following functions are provided:

function intercept

Intercept of regression line.

num intercept(lrel[num,num] values) throws IllegalArgument

Returns the interce of the estimated regression line. The least squares estimate of the intercept is computed using these normal equations

function interceptStdErr

Standard error of intercept estimate.

num interceptStdErr(lrel[num,num] values) throws IllegalArgument

Returns the http://www.xycoon.com/standarderrorb0.htm[standard error of the intercept estimate], usually denoted s(b0).

function meanSquareError

Sum of squared errors divided by the degrees of freedom.

num meanSquareError(lrel[num,num] values) throws IllegalArgument

Returns the sum of squared errors divided by the degrees of freedom, usually abbreviated MSE.

function R

Pearson's product-moment correlation coefficient.

num R(lrel[num,num] values) throws IllegalArgument

Computes Pearson's product-moment correlation coefficient. More functions related to this coefficient can be found in Correlation.

function regressionSumSquares

Sum of squared deviations of the predicted y values about their mean.

num regressionSumSquares(list[tuple[num,num]] values) throws IllegalArgument

Returns the sum of squared deviations of the predicted y values about their mean (which equals the mean of y). This is usually abbreviated SSR or SSM.

function RSquare

Coefficient of determination.

num RSquare(lrel[num,num] values) throws IllegalArgument

Returns the coefficient of determination usually denoted r__^2^. It provides a measure of how well future outcomes are likely to be predicted by the regression model.

function significance

Significance of the slope correlation.

num significance(lrel[num,num] values) throws IllegalArgument

Returns the significance level of the slope (equiv) correlation. Specifically, the returned value is the smallest alpha such that the slope confidence interval with significance level equal to alpha does not include 0. On regression output, this is often denoted Prob(|t| > 0)

Pitfalls

The validity of this statistic depends on the assumption that the observations included in the model are drawn from a Bivariate Normal Distribution.

function slope

Slope of regression line.

num slope(lrel[num,num] values) throws IllegalArgument

Returns the slope of the estimated regression line. The least squares estimate of the slope is computed using the http://www.xycoon.com/estimation4.htm[normal equations]. The slope is sometimes denoted b1.

function slopeConfidenceInterval

The 95% slope confidence interval.

num slopeConfidenceInterval(lrel[num,num] values) throws IllegalArgument

Returns the half-width of a 95% confidence interval for the slope estimate. The 95% confidence interval is

(slope - slopeConfidenceInterval, slope + slopeConfidenceInterval)

Pitfalls

  • The validity of this statistic depends on the assumption that the observations included in the model are drawn from a Bivariate Normal Distribution

function slopeStdErr

Standard error of slope estimate.

num slopeStdErr(lrel[num,num] values) throws IllegalArgument

Returns the http://www.xycoon.com/standarderrorb0.htm[standard error of the slope estimate], usually denoted s(b1).

function sumOfCrossProducts

Sum of cross products of observations.

num sumOfCrossProducts(lrel[num,num] values) throws IllegalArgument

Returns the sum of crossproducts, xᵢ*yᵢ.

function sumSquaredErrors

Sum of squared errors.

num sumSquaredErrors(lrel[num,num] values) throws IllegalArgument

Returns the sum of squared errors (SSE) associated with the regression model. The sum is computed using the computational formula

SSE = SYY - (SXY * SXY / SXX)

where SYY is the sum of the squared deviations of the y values about their mean, SXX is similarly defined and SXY is the sum of the products of x and y mean deviations.

The return value is constrained to be non-negative, i.e., if due to rounding errors the computational formula returns a negative result, 0 is returned.

function totalSumSquares

Sum of squared deviations.

num totalSumSquares(lrel[num,num] values) throws IllegalArgument

Returns the sum of squared deviations of the y values about their mean. This is defined as http://www.xycoon.com/SumOfSquares.htm[SSTO].

function XSumSquares

Sum of squared deviations of x values about their mean.

num XSumSquares(lrel[num,num] values) throws IllegalArgument

Returns the sum of squared deviations of the x values about their mean.

function predict

Predict a value.

num predict(lrel[num,num] values, num x) throws IllegalArgument

Returns the "predicted" y value associated with the supplied x value, based on regression model derived from the provided data values:

predict(x) = intercept + slope * x