Perform Univariate Linear Regression Separately for Columns of X
Source:R/univariate_regression.R
univariate_regression.RdThis function performs the univariate linear regression y ~ x separately for each column x of X. The estimated effect size and stardard error for each variable are outputted.
Usage
univariate_regression(
X,
y,
Z = NULL,
center = TRUE,
scale = FALSE,
return_residuals = FALSE,
method = c("lmfit", "sumstats")
)Arguments
- X
n by p matrix of regressors.
- y
n-vector of response variables.
- Z
Optional n by k matrix of covariates to be included in all regresions. If Z is not
NULL, the linear effects of covariates are removed from y first, and the resulting residuals are used in place of y.- center
If
center = TRUE, center X, y and Z.- scale
If
scale = TRUE, scale X, y and Z.- return_residuals
Whether or not to output the residuals if Z is not
NULL.- method
Either “sumstats” (faster implementation) or “lmfit” (uses
.lm.fit).
