| Type: | Package |
| Title: | S-Type Ridge Regression |
| Version: | 0.1.0 |
| Description: | Implements S-type ridge regression, a robust and multicollinearity-aware linear regression estimator that combines S-type robust weighting (via the 'Stype.est' package) with ridge penalization; automatically selects the ridge parameter using the 'ridgregextra' approach targeting a close to 1 variance inflation factor (VIF), and returns comprehensive outputs (coefficients, fitted values, residuals, mean squared error (MSE), etc.) with an easy x/y interface and optional user-supplied weights. See Sazak and Mutlu (2021) <doi:10.1080/03610918.2021.1928196>, Karadag et al. (2023) https://CRAN.R-project.org/package=ridgregextra and Sazak et al. (2025) https://CRAN.R-project.org/package=Stype.est. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.0.0) |
| Imports: | stats, mctest, isdals, ridgregextra, Stype.est |
| Suggests: | knitr, rmarkdown |
| URL: | https://github.com/filizkrdg/Styperidge.reg |
| BugReports: | https://github.com/filizkrdg/Styperidge.reg/issues |
| RoxygenNote: | 7.3.3 |
| NeedsCompilation: | no |
| Packaged: | 2026-01-09 09:21:53 UTC; pc |
| Author: | Filiz Karadag |
| Maintainer: | Filiz Karadag <filiz.karadag@ege.edu.tr> |
| Repository: | CRAN |
| Date/Publication: | 2026-01-12 20:30:07 UTC |
Weighted ridge regression
Description
Fits a ridge regression model with observation-specific weights. The weights
can be supplied as a vector, data frame, or a square weight matrix. If a
vector or data frame is supplied, it is internally converted to a diagonal
weight matrix.
In the example below, the weight vector W is generated from a
Uniform(0, 1) distribution purely to illustrate how to call the function.
In practice, users should provide weights that reflect the structure of
their data.
Usage
Weightedridge.reg(x, y, W)
Arguments
x |
Explanatory variables. A data.frame or matrix with observations in rows and predictors in columns. |
y |
Dependent variable. A numeric vector, data.frame, or matrix. For a
univariate response, this should be a length- |
W |
Observation weights. Can be
If |
Value
A list with the following components:
- cc
Numeric scalar. The selected ridge parameter
k.- beta
Numeric matrix (
p x 1). Ridge regression coefficients on the standardized scale (no intercept).- betaor
Numeric matrix (
(p+1) x 1). Coefficients on the original (unstandardized) scale, including the intercept in the first row.- e
Numeric matrix (
n x 1). Residuals on the standardized scale (yr - yhat).- ew
Numeric matrix (
n x 1). Weighted residuals (W^(1/2) %*% e).- yhat
Numeric matrix (
n x 1). Fitted values on the standardized scale (xr %*% beta).- yhatw
Numeric matrix (
n x 1). Fitted values in the weighted standardized space (xrw %*% beta).- yhator
Numeric matrix (
n x 1). Fitted values on the original scale usingbetaor.- MSE
Numeric scalar. Mean squared error (MSE) computed from weighted residuals.
- F
Numeric scalar. Overall model F statistic based on the weighted ANOVA decomposition.
- sig
Numeric scalar. P-value associated with
F.- varbeta
Numeric matrix (
p x p). Estimated covariance matrix ofbetaon the standardized scale.- stdbeta
Numeric vector (length
p). Standard errors ofbeta.- R2
Numeric scalar. Weighted coefficient of determination (R-squared).
- R2adj
Numeric scalar. Adjusted weighted R-squared.
- anovatable
A
data.frame. ANOVA-style table with sums of squares, degrees of freedom, mean squares,F, and p-value.- confint
Numeric matrix (
2 x p). Confidence intervals forbeta; first row is lower, second row is upper.
Examples
## Example: Weighted ridge regression using the bodyfat data from isdals
library(isdals)
data(bodyfat)
## Explanatory variables (x) and response (y)
x <- bodyfat[ , -1] # all columns except the first: predictors
y <- bodyfat[ , 1] # first column: response (body fat percentage)
## Generate observation weights uniformly on [0, 1]
n <- nrow(x)
W <- runif(n, min = 0, max = 1)
## Fit the weighted ridge regression model
fit <- Weightedridge.reg(x, y, W)
## Inspect some key outputs
fit$beta # coefficients in the standardized scale
fit$betaor # coefficients in the original scale (including intercept)
fit$R2 # R-squared
fit$R2adj # Adjusted R-squared
fit$anovatable # ANOVA table
Full regression results using the S-type robust ridge regression estimators
Description
Full regression results using the S-type robust ridge regression estimators
Usage
regstyperidge(x, y)
Arguments
x |
Explanatory variables (data.frame, matrix) |
y |
Dependent variables (data.frame, vector) |
Value
A list of lists
Examples
library("mctest")
x <- Hald[,-1]
y <- Hald[,1]
regstyperidge(x,y)
library(isdals)
data(bodyfat)
x <- bodyfat[,-1]
y <- bodyfat[,1]
regstyperidge(x,y)