View source: R/bootstrapCalibration.R
lm_test | R Documentation |
Compute the marginal t-statistics for a set of contrasts and their (two-sided) p-value.
lm_test(Y, X, C, alternative = c("two.sided", "less", "greater"))
Y |
A data matrix of size $n$ observations (in row) and $D$ features in columns |
X |
A design matrix of size $n$ observations (in row) and $p$ variables (in columns) |
C |
A contrast matrix of size $L$ tested contrasts (in row) and $p$ columns corresponding to the parameters to be tested |
alternative |
A character string specifying the alternative hypothesis. Must be one of "two.sided" (default), "greater" or "less". |
Based on a python implementation available in the pyperm
package: https://github.com/sjdavenport/pyperm/
A list with elements:
A n \times D
matrix of residuals
A L \times D
matrix of test statistics
A L \times D
matrix of p-values
A n \times D
matrix of parameter estimates
Davenport, S., Thirion, B., & Neuvial, P. (2025). FDP control in mass-univariate linear models using the residual bootstrap. Electronic Journal of Statistics, 19(1), 1313-1336.
N <- 100
p <- 2
D <- 2
X <- matrix(0, nrow = N, ncol = p)
X[, 1] <- 1
X[, -1] <- runif(N*(p-1), min = 0, max = 3)
beta <- matrix(0, nrow = p, ncol = D)
epsilons <- matrix(rnorm(N*D), nrow = N, ncol = D)
Y <- X %*% beta + epsilons
C <- diag(p)
resLM <- lm_test(Y = Y, X = X, C = C)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.