rcModelPLMd: Fit robust row-column models to a matrix

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plmd.R

Description

These functions fit row-column effect models to matrices using PLM-d

Usage

1
rcModelPLMd(y,group.labels)

Arguments

y

A numeric matrix

group.labels

A vector of group labels. Of length ncol(y)

Details

This functions first tries to fit row-column models to the specified input matrix. Specifically the model

y_ij = r_i + c_j + e_ij

with r_i and c_j as row and column effects respectively. Note that these functions treat the row effect as the parameter to be constrained using sum to zero.

Next the residuals for each row are compared to the group variable. In cases where there appears to be a significant relationship, the row-effect is "split" and separate row-effect parameters, one for each group, replace the single row effect.

Value

A list with following items:

Estimates

The parameter estimates. Stored in column effect then row effect order

Weights

The final weights used

Residuals

The residuals

StdErrors

Standard error estimates. Stored in column effect then row effect order

WasSplit

An indicator variable indicating whether or not a row was split with separate row effects for each group

Author(s)

B. M. Bolstad bmb@bmbolstad.com

See Also

rcModelPLM,rcModelPLMr

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
col.effects <- c(10,11,10.5,12,9.5)
row.effects <- c(seq(-0.5,-0.1,by=0.1),seq(0.1,0.5,by=0.1))


y <- outer(row.effects, col.effects,"+")
y <- y + rnorm(50,sd=0.1)

rcModelPLMd(y,group.labels=c(1,1,2,2,2))


row.effects <- c(4,3,2,1,-1,-2,-3,-4)
col.effects  <- c(8,9,10,11,12,10)

y <- outer(row.effects, col.effects,"+") + rnorm(48,0,0.25)

y[8,4:6] <- c(11,12,10)+ 2.5 + rnorm(3,0,0.25)
y[5,4:6] <- c(11,12,10)+-2.5 + rnorm(3,0,0.25)


rcModelPLMd(y,group.labels=c(1,1,1,2,2,2))

par(mfrow=c(2,2))
matplot(y,type="l",col=c(rep("red",3),rep("blue",3)),ylab="residuals",xlab="probe",main="Observed Data")
matplot(rcModelPLM(y)$Residuals,col=c(rep("red",3),rep("blue",3)),ylab="residuals",xlab="probe",main="Residuals (PLM)")
matplot(rcModelPLMd(y,group.labels=c(1,1,1,2,2,2))$Residuals,col=c(rep("red",3),rep("blue",3)),xlab="probe",ylab="residuals",main="Residuals (PLM-d)")

preprocessCore documentation built on Jan. 10, 2021, 2:01 a.m.