Sibei Liu (sxl4188@miami.edu) and Min Lu (luminwin@gmail.com)
Liu, S. and Lu, M. (2026). Variance-Guided Regression for Heteroscedastic Data. TechRxiv. DOI: 10.36227/techrxiv.177004877.75352102/v1
The CRAN release of varGuid implements the global linear mean-variance model from Section 2 of the paper via iteratively reweighted least squares (IRLS) and iteratively reweighted lasso estimation. For the grouping-based nonlinear prediction extension from Section 3 of the paper, please use the development version available at:
devtools::install_github("luminwin/varGuid")install.packages("varGuid")
library(varGuid)data(cobra2d, package = "varGuid")
dat <- cobra2d
set.seed(1)
tid <- sample(seq_len(nrow(dat)), 200)
train <- dat[-tid, ]
test <- dat[tid, ]
yid <- which(colnames(dat) == "y")o <- lmv(X = train[, -yid], Y = train[, yid], lasso = FALSE)
summary(o$obj.varGuid) # varGuid weighted fit
summary(o$obj.OLS) # baseline OLS fit
head(prd(o, train[, -yid], model = "baseline"))
head(prd(o, train[, -yid], model = "varGuid"))
# The corresponding base R calls are:
head(stats::predict(o$obj.OLS, newdata = as.data.frame(train[, -yid])))
head(stats::predict(o$obj.varGuid, newdata = as.data.frame(train[, -yid])))o2 <- lmv(X = train[, -yid], Y = train[, yid], lasso = TRUE)
o2$beta # varGuid-lasso coefficients
o2$obj.lasso$beta # baseline lasso coefficients
head(prd(o2, train[, -yid], model = "baseline"))
head(prd(o2, train[, -yid], model = "varGuid"))
# The corresponding glmnet calls are:
head(drop(glmnet::predict.glmnet(o2$obj.lasso,
newx = as.matrix(train[, -yid]))))
head(drop(glmnet::predict.glmnet(o2$obj.varGuid,
newx = as.matrix(train[, -yid]))))