Skip to contents

Fit regression model Y[j,] ~ design for each response j

Usage

lmFitResponses(Y, design, Weights, detail = 1, lambda = 0, nthreads = 1, ...)

# S4 method for class 'matrix'
lmFitResponses(Y, design, Weights, detail = 1, lambda = 0, nthreads = 1, ...)

Arguments

Y

matrix of responses as __rows__

design

design matrix

Weights

matrix sample-level weights the same dimension as Y

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)

lambda

ridge shrinkage parameter

nthreads

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

...

other args

Value

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

Details

Since the weights vary for each response, each model is computed separately without recycling precomputed values

Examples

n <- 100
m <- 5
nc <- 2
set.seed(1)
Y <- matrix(rnorm(n * m), m, n)
X <- matrix(rnorm(n * nc), n, nc)
rownames(Y) <- seq(m)
W <- matrix(runif(n * m), m, n)

# fit regressions with model j using Y[,j] as a response
fit <- lmFitResponses(Y, X, W)

fit
#> 		 lmFitResponses 
#> 
#> coefs(2): V1, V2
#> responses(5): 1, 2, 3, 4, 5
#> family: gaussian/identity 
#> Estimated: se, dispersion, rdf 
#>