linreg_s2: Linear Regression Residual Variance

Description Usage Arguments Value Author(s)

View source: R/linreg.R

Description

Calculates estimates of the residual variance

\mathbf{E} ≤ft( σ^2 \right) = s^2

,

s_{\textrm{OLS}}^{2} = \frac{ \mathbf{e^{\prime} e } } { n - k }

,

s_{\textrm{ML}}^{2} = \frac{ \mathbf{e^{\prime} e } } { n }

.

Usage

1
linreg_s2(beta_hat = NULL, X, y, m = FALSE, s2_est = "both")

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}.

s2_est

String. Residual variance estimator. If "both", returns both OLS and ML estimates as a vector. If "ols", returns OLS estimate. If "ml", returns ML estimate.

Value

Returns the estimated residual variance.

Author(s)

Ivan Jacob Agaloos Pesigan


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