filterCollinearities: Filter collinearities

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

View source: R/Utils.R

Description

Filters out variables or features that lead to collinearities in the input data.

Usage

1
filterCollinearities(X, soft.filter=FALSE, long.dim.are.variables=TRUE)

Arguments

X

data set where collinearities are identified.

soft.filter

logical; if FALSE (default) then the intput object X is returned without the variables or features that lead to collinearities, i.e., a hard-filtered version of X; if TRUE, then a logical mask is returned with as many positions as variables or features and those that lead to collinearities are set to TRUE, while the rest are set to FALSE.

long.dim.are.variables

logical; if TRUE (default) it is assumed that when X is a data.frame or a matrix, the longer dimension is the one defining the random variables (default); if FALSE, then random variables are assumed to be at the columns of the data.frame or matrix.

Details

The input object X can be either a matrix object, a data.frame object or any other class of object that can be handled by the function qpPCC(), which is internally called, such as an ExpressionSet object.

Value

The input object X without the variables or features that lead to collinearities when soft.filter=FALSE, its default value. Otherwise, when soft.filter=TRUE then a logical mask is returned.

Author(s)

R. Castelo

See Also

qpPCC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## build an undirected GMM model with
## average correlation 0.99 on the present edges
set.seed(1234)
gmm <- rUGgmm(dRegularGraphParam(), rho=0.99)
gmm

## sample n=100 observations from this GMM
X <- rmvnorm(100, gmm)
dim(X)
head(X)

## notice some variables lead to collinearities (r > 0.99)
cor(X)

## mask those variables
mask <- filterCollinearities(X, long.dim.are.variables=FALSE,
                             soft.filter=TRUE)
mask
head(X[, !mask])

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