construct_adj_r_squared {PoSIAdjRSquared} | R Documentation |
This function computes the adjusted R squared and returns some useful matrices from this computation.
construct_adj_r_squared(X, k, y, n, intercept = c(TRUE, FALSE), sst)
X |
Design matrix of type "matrix" and dimension nxp |
k |
Index set included in model k |
y |
Response vector of type "matrix" and dimension nx1 |
n |
An integer for the sample size |
intercept |
Logical value: TRUE if fitted models should contain intercept, FALSE if not |
sst |
An integer for the total sum of squares |
X_M_k |
The design matrix of model k |
P_M_k |
The projection matrix of model k |
R_M_k |
The orthogonal projection matrix of model k |
kappa_M_k |
Adjustment factor for model complexity kappa of model k |
adj_r_squared |
The adjusted R squared value of model k |
Pirenne, S. and Claeskens, G. (2024). Exact Post-Selection Inference for Adjusted R Squared.
# Generate data
n <- 100
k <- 1:10
Data <- datagen.norm(seed = 7, n, p = 10, rho = 0, beta_vec = c(1,0.5,0,0.5,0,0,0,0,0,0))
X <- Data$X
y <- Data$y
sst <- sum((y-mean(y))^2)
construct_adj_r_squared(X, k, y, n, intercept=FALSE, sst)