Title: | Linear regression with clustered robust standard errors |
---|---|
Description: | Longtiudinal analysis of high-dimensional data using linear regression with clustered robust standard errors across markers. |
Authors: | James Staley [aut, cre] |
Maintainer: | James Staley <[email protected]> |
License: | GPL-3 |
Version: | 0.0.7 |
Built: | 2024-12-30 03:06:22 UTC |
Source: | https://github.com/jrs95/lmrse |
coerce.lmrse
constructs a results data.frame
from an "lmrse"
object, where coefficients, standard
errors and p-values for each covariable are placed in
consecutive columns.
coerce.lmrse(x)
coerce.lmrse(x)
x |
an object of class |
coerce.lmrse
returns a results data.frame
with
coefficients, standard errors and p-values for the
covariables.
James Staley [email protected]
lmrse
fits a linear regression model with cluster robust
standard errors for all markers.
lmrse(formula, cluster, data = NULL)
lmrse(formula, cluster, data = NULL)
formula |
containing the marker matrix as the response and the exposure and covariates as the dependent terms |
cluster |
clustering variable |
data |
an optional |
lmrse
returns a list
of coefficients, standard errors and
p-values matrices:
coef |
a matrix of regression coefficients |
se |
a matrix of standard errors |
p |
a matrix of p-values |
James Staley [email protected]
# Data y <- rnorm(5000000) y <- matrix(y, ncol = 1000) colnames(y) <- paste0("var", 1:1000) x <- rnorm(5000) cluster <- rep(1:1000, 5) c1 <- rbinom(5000, 1, 0.5) c2 <- rnorm(5000) # Analyses res <- lmrse(y ~ x + c1 + c2, cluster = cluster)
# Data y <- rnorm(5000000) y <- matrix(y, ncol = 1000) colnames(y) <- paste0("var", 1:1000) x <- rnorm(5000) cluster <- rep(1:1000, 5) c1 <- rbinom(5000, 1, 0.5) c2 <- rnorm(5000) # Analyses res <- lmrse(y ~ x + c1 + c2, cluster = cluster)
print method for class "lmrse"
.
## S3 method for class 'lmrse' print(x, ...)
## S3 method for class 'lmrse' print(x, ...)
x |
an object of class |
James Staley [email protected]
print.summary method for class "lmrse"
.
## S3 method for class 'summary.lmrse' print(x, ...)
## S3 method for class 'summary.lmrse' print(x, ...)
x |
an object of class |
James Staley [email protected]
sandwich.se
fits cluster robust standard errors using a
sandwich estimator.
sandwich.se(model, cluster)
sandwich.se(model, cluster)
model |
output from linear model |
cluster |
clustering variable |
sandwich.se
returns a vector of robust standard errors for the
covariables including the intercept.
James Staley [email protected]
# Data y <- rnorm(5000) x <- rnorm(5000) cluster <- rep(1:1000, 5) c1 <- rbinom(5000, 1, 0.5) c2 <- rnorm(5000) # Analyses model <- lm(y ~ x + c1 + c2) se <- sandwich.se(model = model, cluster = cluster)
# Data y <- rnorm(5000) x <- rnorm(5000) cluster <- rep(1:1000, 5) c1 <- rbinom(5000, 1, 0.5) c2 <- rnorm(5000) # Analyses model <- lm(y ~ x + c1 + c2) se <- sandwich.se(model = model, cluster = cluster)
summary method for class "lmrse"
.
## S3 method for class 'lmrse' summary(x, ...)
## S3 method for class 'lmrse' summary(x, ...)
x |
an object of class |
James Staley [email protected]