unrReg {ImpShrinkage}R Documentation

The Unrestricted estimator

Description

This function calculates the unrestricted estimator as

\hat{\beta}^{U} = (X^{\top} X)^{-1} X^{\top} y

where ^{\top} denotes the transpose of a matrix. It is important to note that the input matrices X and y should be standardized, for example, by using scale. Alternatively, the user can employ lm to obtain this estimator, but it is crucial to remember to set intercept = FALSE.

Usage

unrReg(X, y)

Arguments

X

Matrix with input observations, of dimension n x p, where each row is an observation vector;

y

Vector with response observations of size n.

Details

The corresponding unrestricted estimator of \sigma^2 is

s^2 = \frac{1}{n-p}(y-X\hat{\beta}^{U})^{\top}(y - X\hat{\beta}^{U}).

Value

An object of class unrestricted is a list containing at least the following components:

coef

A named vector of coefficients.

residuals

The residuals, that is, the response values minus fitted values.

s2

The estimated variance.

fitted.values

The fitted values.

References

Saleh, A. K. Md. Ehsanes. (2006). Theory of Preliminary Test and Stein‐Type Estimation With Applications, Wiley.

Examples

data(cement)
n_obs <- 100
p_vars <- 5
beta <- c(2, 1, 3, 0, 5)
simulated_data <- simdata(n = n_obs, p = p_vars, beta)
X <- simulated_data$X
y <- simulated_data$y
unrReg(X, y)

data(cement)
X <- as.matrix(cbind(1, cement[, 1:4]))
y <- cement$y
# Based on Kaciranlar et al. (1999)
H <- matrix(c(0, 1, -1, 1, 0), nrow = 1, ncol = 5, byrow = TRUE)
h <- rep(0, nrow(H))
unrReg(X, y)

H <- matrix(c(0, 1, -1, 1, 0, 0, 0, 1, -1, -1, 0, 1, -1, 0, -1), nrow = 3, ncol = 5, byrow = TRUE)
h <- rep(0, nrow(H))
unrReg(X, y)

[Package ImpShrinkage version 1.0.0 Index]