linreg_r2: Linear Regression (R-square)

Description Usage Arguments Value Author(s)

View source: R/linreg.R

Description

Calculates the coefficient of determination (R^2 = 1 - \frac{\textrm{Residual sum of squares}}{\textrm{Total sum of squares}} or R^2 = \frac{\textrm{Explained sum of squares}}{\textrm{Total sum of squares}}).

Usage

1
linreg_r2(beta_hat = NULL, X, y, m = FALSE, rss = TRUE)

Arguments

beta_hat

Vector of k estimated regression parameters. If NULL, regression coefficients are estimated using ≤ft( \mathbf{X}^{\prime} \mathbf{X} \right)^{-1} ≤ft( \mathbf{X}^{\prime} \mathbf{y} \right) .

X

The data matrix, that is an n \times k matrix of n observations of k regressors, which includes a regressor whose value is 1 for each observation.

y

n \times 1 vector of observations on the regressand variable.

m

Logical. If TRUE, the function uses an alternative formula e = \mathbf{M} \mathbf{y} . See linreg_m for \mathbf{M}.

rss

Logical. If TRUE, the function uses the residual sum of squares in the calculation. If FALSE, the function uses the estimated sum of squares in the calculation.

Value

Returns the coefficient of determination R^2.

Author(s)

Ivan Jacob Agaloos Pesigan


jeksterslabds/jeksterslabRds documentation built on July 16, 2020, 3:41 p.m.