PPLS | R Documentation |
This function performs Penalized Partial Least Squares (PPLS) estimation for grouped data. It supports ridge regression regularization and handles missing data by excluding incomplete cases. The function returns regression coefficients, residual sum of squares, and other diagnostic information.
PPLS(d, yidx, Xidx, n, lam = 0.005)
d |
Containing the dependent and independent variables. |
yidx |
Column index of the dependent variable in |
Xidx |
Column indices of the independent variables in |
n |
Vector of sample sizes for each group. |
lam |
Regularization parameter for ridge regression (default is 0.005). |
This function assumes that the data is grouped and that the sample sizes for each group are provided. It excludes cases with missing values in the dependent or independent variables. The function uses Cholesky decomposition to solve the regularized least squares problem.
A list containing the following elements:
beta |
Regression coefficients. |
SSE |
Residual sum of squares. |
df |
Number of complete cases used in the estimation. |
gram |
Gram matrix ( |
cgram |
Cholesky decomposition of the Gram matrix. |
comm |
Indicator variable (0 for single group, 1 for multiple groups). |
# Example data
set.seed(123)
n_total <- 1000
p <- 5
n_groups <- c(300, 300, 400)
d <- list(all = cbind(rnorm(n_total), matrix(rnorm(n_total*p), ncol=p)),p = p)
# Call PPLS function
result <- PPLS(d, yidx=1, Xidx=2:(p+1), n=n_groups)
# View results
print(result$beta) # Regression coefficients
print(result$SSE) # Residual sum of squares
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.