Learn R Programming

AdapDiscom (version 1.0.0)

compute.xty: Compute X'y Vector

Description

Compute X'y Vector

Usage

compute.xty(x, y, robust = 0, k_value = 1.5)

Value

Covariance vector

Arguments

x

Matrix, input data matrix

y

Vector, response vector

robust

Integer, 0 for classical estimate, 1 for Huber robust estimate

k_value

Numeric, tuning parameter for Huber function

Examples

Run this code
# Create sample data
set.seed(123)
x <- matrix(rnorm(100), 20, 5)
y <- rnorm(20)
x[sample(100, 8)] <- NA  # Missing values in x

# Classical cross-covariance
xty_classical <- compute.xty(x, y, robust = 0)
print(round(xty_classical, 3))

# Robust cross-covariance
xty_robust <- compute.xty(x, y, robust = 1)
print(round(xty_robust, 3))

Run the code above in your browser using DataLab