Extracts fitted coefficients.

Share:

Description

Takes a list of fitted models (lm objects) and returns coefficients in matrix format.

Usage

1
coefmat(lst,regressors)

Arguments

lst

list of lm objects.

regressors

character vector. Names of the coefficients to extract.

Details

Simple wrapper function that returns fitted coefficients.

The names of the coefficient to extract are matched in names(lst[[i]]$coef).

The column in the matrix of extracted coefficients are named by prepending "coef." to the regressor names.

Value

coefm

numeric matrix. Matrix of extracted coefficients with one row for each model in the list and one column for each targeted coefficient.

Author(s)

Alexandre Kuhn alexandre.m.kuhn@gmail.com

See Also

pvalmat.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Load example expression data (variable "expression")
## and phenotype data (variable "groups")
data("example")

## Four cell population-specific reference signals
neuron_probesets <- list(c("221805_at", "221801_x_at", "221916_at"),
                "201313_at", "210040_at", "205737_at", "210432_s_at")
neuron_reference <- marker(expression, neuron_probesets)

astro_probesets <- list("203540_at",c("210068_s_at","210906_x_at"),
                "201667_at")
astro_reference <- marker(expression, astro_probesets)

oligo_probesets <- list(c("211836_s_at","214650_x_at"),"216617_s_at",
                "207659_s_at",c("207323_s_at","209072_at"))
oligo_reference <- marker(expression, oligo_probesets)

micro_probesets <- list("204192_at", "203416_at")
micro_reference <- marker(expression, micro_probesets)

## Stepwise model selection for 2 transcripts (202429_s_at and
## 200850_s_at) and focusing on control samples (i.e. groups == 0)
lmlist <- swlm(expression[c("202429_s_at", "200850_s_at"),],
		subset = which(groups == 0),
		upper = formula(~neuron_reference + astro_reference +
			oligo_reference + micro_reference))

coefmat(lmlist, c("(Intercept)", "neuron_reference", "astro_reference",
		"oligo_reference", "micro_reference"))