Learn R Programming

ImpShrinkage (version 1.0.0)

predict.preliminaryTest: Extract Model Predictions Values

Description

Predicted values based on object preliminaryTest.

Usage

# S3 method for preliminaryTest
predict(object, newdata, ...)

Value

A vector of predictions.

Arguments

object

An object of class "preliminaryTest".

newdata

An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

...

Other arguments.

See Also

predict.unrestricted, predict.restricted, predict.improvedpreliminaryTest, predict.stein, predict.positivestein.

Examples

Run this code
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
p <- ncol(X)
# H beta = h
H <- matrix(c(1, 1, -1, 0, 0, 1, 0, 1, 0, -1, 0, 0, 0, 1, 0), nrow = 3, ncol = p, byrow = TRUE)
h <- rep(0, nrow(H))
model <- ptReg(X, y, H, h, alpha = 0.05)
predict(model, X)

Run the code above in your browser using DataLab