Categories &

Functions List

Function Reference: regress

statistics: [b, bint, r, rint, stats] = regress (y, X, [alpha])

Multiple Linear Regression using Least Squares Fit of y on X with the model y = X * beta + e.

Here,

  • y is a column vector of observed values
  • X is a matrix of regressors, with the first column filled with the constant value 1
  • beta is a column vector of regression parameters
  • e is a column vector of random errors

Arguments are

  • y is the y in the model
  • X is the X in the model
  • alpha is the significance level used to calculate the confidence intervals bint and rint (see ‘Return values’ below). If not specified, ALPHA defaults to 0.05

Return values are

  • b is the beta in the model
  • bint is the confidence interval for b
  • r is a column vector of residuals
  • rint is the confidence interval for r
  • stats is a row vector containing:
    • The R^2 statistic
    • The F statistic
    • The p value for the full model
    • The estimated error variance

r and rint can be passed to rcoplot to visualize the residual intervals and identify outliers.

NaN values in y and X are removed before calculation begins.

See also: regress_gp, regression_ftest, regression_ttest

Source Code: regress