Skip to contents

Fit regression model y ~ design + X_features[,j] for each feature j

Usage

lmFitFeatures(
  y,
  design,
  data,
  weights,
  detail = 1,
  preprojection = TRUE,
  lambda = 0,
  nthreads = 1,
  ...
)

# S4 method for class 'ANY,ANY,matrix'
lmFitFeatures(
  y,
  design,
  data,
  weights,
  detail = 1,
  preprojection = TRUE,
  lambda = 0,
  nthreads = 1,
  ...
)

Arguments

y

response vector

design

design matrix shared across all models

data

feature matrix with model j using feature j

weights

sample-level weights

detail

level of model detail returned, with LEAST = 0, LOW = 1, MEDIUM = 2, HIGH = 3, MOST = 4, MAX = 5. LEAST (beta), LOW (beta, se, sigSq, rdf), MEDIUM (vcov), HIGH (residuals), MOST (hatvalues), MAX (deviance residuals)

preprojection

default TRUE. Use preproject of design matrix to accelerate calculations

lambda

ridge shrinkage parameter

nthreads

number of threads. Each model is fit in serial, analysis is parallelized across features

...

other args

Value

List of parameter estimates with entries coef, se, sigSq, rdf and other depending on detail

Examples

n <- 100 # number of samples
p <- 10 # number of features
nc <- 3 # number shared covariates
set.seed(1)
y <- rnorm(n)
X <- matrix(rnorm(n * p), n, p)
colnames(X) <- seq(p)
design <- matrix(rnorm(n * nc), n, nc)
w <- seq(n)
w <- w / mean(w)

# fit regressions with model j including X[,j]
fit <- lmFitFeatures(y, design, X, w)

fit
#> 		 lmFitFeatures 
#> 
#> coefs(1): x
#> features(10): 1, 2, ..., 9, 10
#> family: gaussian/identity 
#> Estimated: se, dispersion, rdf 
#>