Description Usage Arguments Value Author(s) References See Also Examples
Estimates coefficients of a linear regression model using QR Decomposition. The data matrix \mathbf{X} is decomposed into
\mathbf{X} = \mathbf{Q} \mathbf{R} .
Estimates are found by solving \boldsymbol{\hat{β}} in
\mathbf{R} \boldsymbol{\hat{β}} = \mathbf{Q}^{T} \mathbf{y}.
1 | .betahatqr(X, y)
|
X |
|
y |
Numeric vector of length |
Returns \boldsymbol{\hat{β}}, that is, a k \times 1 vector of estimates of k unknown regression coefficients estimated using ordinary least squares.
Ivan Jacob Agaloos Pesigan
Wikipedia: Ordinary least squares
Wikipedia: Orthogonal decomposition methods
Other beta-hat functions:
.betahatnorm()
,
.betahatsvd()
,
.intercepthat()
,
.slopeshatprime()
,
.slopeshat()
,
betahat()
,
intercepthat()
,
slopeshatprime()
,
slopeshat()
1 2 3 4 5 6 7 8 9 10 11 | # Simple regression------------------------------------------------
X <- jeksterslabRdatarepo::wages.matrix[["X"]]
X <- X[, c(1, ncol(X))]
y <- jeksterslabRdatarepo::wages.matrix[["y"]]
.betahatqr(X = X, y = y)
# Multiple regression----------------------------------------------
X <- jeksterslabRdatarepo::wages.matrix[["X"]]
# age is removed
X <- X[, -ncol(X)]
.betahatqr(X = X, y = y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.