residualize: Compute a regression model for each column in a matrix and...

Description Usage Arguments Examples

View source: R/asca.R

Description

Compute a regression model for each column in a matrix and return residual matrix

Usage

1
residualize(form, X, design)

Arguments

form

the formula defining the model to fit for residuals

X

the response matrix

design

the data.frame containing the design variables specified in form argument.

Examples

1
2
3
4
5
6
7
X <- matrix(rnorm(20*10), 20, 10)
des <- data.frame(a=rep(letters[1:4], 5), b=factor(rep(1:5, each=4)))
xresid <- residualize(~ a+b, X, design=des)

## design is saturated, residuals should be zero
xresid2 <- residualize(~ a*b, X, design=des)
sum(xresid2) == 0

bbuchsbaum/neuropls documentation built on Dec. 9, 2020, 7:02 p.m.