| Title: | Performs Large Scale Regressions |
|---|---|
| Description: | Routines to perform large scale regression. Linear, logistic, and Poisson regressions are supported. Large scale regression efficiently fits models where a small number of covariates are changing and the subjects have complete data. A genome wide association study would be an example. |
| Authors: | John Morrison [aut, cre], NCI [fnd] (CA196559), NCI [fnd] (CA201407), NIEHS [fnd] (ES007048), NHLBI [fnd] (HL115606) |
| Maintainer: | John Morrison <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.0 |
| Built: | 2026-05-29 10:46:45 UTC |
| Source: | https://github.com/cran/lsReg |
Computes a hypothesis test statistic for one or more new covariates
xr using memory pre-allocated by lsReg.
addcovar(lsregmem, xr)addcovar(lsregmem, xr)
lsregmem |
An object of class |
xr |
Numeric matrix of additional covariates to test. Number of columns
must match the |
Invisibly returns the exit code (0 on success, nonzero on error).
After a successful call, results are stored in the lsregmem object:
lsregmem$testvalueThe test statistic. For "lrt"
this is a chi-square statistic (p-values via pchisq). For all
other test types this is a z-score (p-values via pnorm).
lsregmem$fitdata$betabThe parameter estimate(s) for
xr. Not meaningful for "score" or "robustscore",
which do not fit the full model.
datafile <- system.file("extdata", "simulated_data.rds", package = "lsReg") dat <- readRDS(datafile) basemdl <- glm(ylin ~ x1 + x2, data = dat, family = gaussian) mem <- lsReg(basemdl, colstoadd = 1, testtype = "wald") addcovar(mem, as.matrix(dat[, "z5", drop = FALSE])) mem$fitdata$betab[1] # parameter estimate for z5 mem$testvalue[1, 1] # Wald z-score for z5datafile <- system.file("extdata", "simulated_data.rds", package = "lsReg") dat <- readRDS(datafile) basemdl <- glm(ylin ~ x1 + x2, data = dat, family = gaussian) mem <- lsReg(basemdl, colstoadd = 1, testtype = "wald") addcovar(mem, as.matrix(dat[, "z5", drop = FALSE])) mem$fitdata$betab[1] # parameter estimate for z5 mem$testvalue[1, 1] # Wald z-score for z5
Prepares and caches data structures from a fitted base GLM for use in
repeated large-scale hypothesis tests via addcovar.
lsReg(basemdl, colstoadd, testtype)lsReg(basemdl, colstoadd, testtype)
basemdl |
Base model of the form |
colstoadd |
Number of columns in |
testtype |
Character string specifying the test type. One of
|
An object of class lsregmem containing pre-allocated matrices
and cached quantities from the base model, for use with addcovar.
datafile <- system.file("extdata", "simulated_data.rds", package = "lsReg") dat <- readRDS(datafile) basemdl <- glm(ylin ~ x1 + x2, data = dat, family = gaussian) mem <- lsReg(basemdl, colstoadd = 1, testtype = "wald")datafile <- system.file("extdata", "simulated_data.rds", package = "lsReg") dat <- readRDS(datafile) basemdl <- glm(ylin ~ x1 + x2, data = dat, family = gaussian) mem <- lsReg(basemdl, colstoadd = 1, testtype = "wald")