% -*- texinfo -*- % @deftypefn {Function File} {[@var{b}, @var{bint}, @var{r}, @var{rint}, @var{stats}] =} regress (@var{y}, @var{X}, [@var{alpha}]) % Multiple Linear Regression using Least Squares Fit of @var{y} on @var{X} % with the model @code{y = X * beta + e}. % % Here, % % @itemize % @item % @code{y} is a column vector of observed values % @item % @code{X} is a matrix of regressors, with the first column filled with % the constant value 1 % @item % @code{beta} is a column vector of regression parameters % @item % @code{e} is a column vector of random errors % @end itemize % % Arguments are % % @itemize % @item % @var{y} is the @code{y} in the model % @item % @var{X} is the @code{X} in the model % @item % @var{alpha} is the significance level used to calculate the confidence % intervals @var{bint} and @var{rint} (see `Return values' below). If not % specified, ALPHA defaults to 0.05 % @end itemize % % Return values are % % @itemize % @item % @var{b} is the @code{beta} in the model % @item % @var{bint} is the confidence interval for @var{b} % @item % @var{r} is a column vector of residuals % @item % @var{rint} is the confidence interval for @var{r} % @item % @var{stats} is a row vector containing: % % @itemize % @item The R^2 statistic % @item The F statistic % @item The p value for the full model % @item The estimated error variance % @end itemize % @end itemize % % @var{r} and @var{rint} can be passed to @code{rcoplot} to visualize % the residual intervals and identify outliers. % % NaN values in @var{y} and @var{X} are removed before calculation begins. % % @end deftypefn