Skip to contents

This function takes as input a design matrix X and output vector y and fits a linear regression model (without an intercept – X and y should be centered). It then conducts F-screening as defined in "Valid F-screening in linear regression" by

  1. testing the overall hypothesis that all coefficients in the linear regression are zero using an F-test, and

  2. if this overall test is rejected, it outputs selective p-values, confidence intervals, and point estimates for the coefficients in the linear regression model that condition on the rejection of the overall F-test. If the overall test is not rejected, it returns the overall F-statistic and indicates that it is not significant.

Usage

lmFScreen.fit(
  X,
  y,
  alpha = 0.05,
  alpha_ov = 0.05,
  test_cols = 1:ncol(X),
  sigma_sq = NULL,
  compute_CI = TRUE,
  compute_est = TRUE,
  B = 1e+05
)

Arguments

X

A numeric matrix of predictors.

y

A numeric response vector.

alpha

Significance level for confidence intervals and hypothesis tests (default: 0.05).

alpha_ov

Significance level for the overall F-test used for screening (default: 0.05).

test_cols

Indices of predictors to test (default: all columns of X).

sigma_sq

Optional noise variance. If NULL, it is estimated using a corrected residual variance.

compute_CI

Logical; whether to compute selective confidence intervals (default: TRUE).

compute_est

Logical; whether to compute selective point estimates (default: TRUE).

B

Number of Monte Carlo samples used for selective inference (default: 100000).

Value

A list of class lmFScreen containing:

  • Selective coefficients, confidence intervals, and p-values

  • Standard (OLS) coefficients, confidence intervals, and p-values

  • Model settings: alpha and alpha_ov

Examples

data(mtcars)
X <- cbind(mtcars$wt, mtcars$hp)
y <- mtcars$mpg
svdP <- svd(rep(1,nrow(mtcars)), nu = nrow(mtcars))
tol <- nrow(mtcars) * max(svdP$d) * .Machine$double.eps
r <- sum(svdP$d > tol)
U_full <- svdP$u
U_perp <- U_full[, (r+1):ncol(U_full)]
X <- t(U_perp) %*% X
y <- t(U_perp) %*% y
result <- lmFScreen.fit(X,y)
#> Error in lmFScreen.fit(X, y): could not find function "lmFScreen.fit"
summary(result)
#> Error: object 'result' not found
coef(result)
#> Error: object 'result' not found
confint(result)
#> Error: object 'result' not found