plot.SplitVarsByLayerAndMAF: visualize category frequencies of split variable

Description Usage Arguments Details See Also Examples

Description

Plots (relative) frequencies of 2- and/or 3- categorical variables stratified for Layer and MAF.

Usage

1
2
3
4
plot.SplitVarsByLayerAndMAF(x = list(), fun = relative,
	row.num = 1, col.num = 1, row.denom = NULL, col.denom = NULL,   
	col = 1:4, main = character(), ylab = character(), ylim, xlim, 
	legPos = "topright", norm.by.nodes = FALSE, layerForest, ...)

Arguments

x

A list of class SplitVarsByLayerAndMAF that is returned by tableSplitVarsByLayerAndMAF.

fun

The function to preprocess the data (x) to be plotted. One of c("relative", "absolute"). Defaults to "relative". See details.

row.num, col.num, row.denom, col.denom

Passed to fun (see above). See details section.

col

A vector containing the colors to be used for the different MAFs. Passed to plot.

main, ylab, xlim, ylim

See plot.

legPos

The position of the legend. Passed to legend.

norm.by.nodes

A logical indicating whether the absolute/relative frequencies should be normed by the number of nodes per layer. Defaults to FALSE.

layerForest

If norm.by.nodes = TRUE one has to provide the layer information for the according forest (see examples).

...

Further arguments passed to plot.

Details

If fun == "absolute" , row.denom and col.denom are ignored, and fun simply extracts the frequencies from x for the according row.num, col.num combination in all list elements, i.e. all layers.

If fun == "relative", per default you get relative instead of absolute frequencies when row.denom and col.denom are not specified. Otherwise for all list-elements the quotient tab[row.nom, col.nom]/tab[row.denom, col.denom] is returned.

See Also

tableSplitVarsByLayerAndMAF

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
30
## data
YX <- simulateSNPdata(seed = 123)

## forest
rF <- randomForest(x = YX[ , -1], y = YX[ , 1], keep.forest = TRUE, 
		keep.inbag = TRUE, importance = TRUE, ntree = 500)
		
## category frequencies
cF <- getCategoryFrequenciesForest(rF, YX[ , -1])

## table for all Levels vs. Layer
tab1 <- tableLevelsVsLayerByMAF(cF, rF)
tab2 <- tableSplitVarLevelsVsLayerByMAF(cF, rF)
tab3 <- tableSplitVarsByLayerAndMAF(tab1, tab2)

layout(matrix(1:4, nrow = 2, byrow = TRUE))
plot(tab3, row.num = 1, col.num = 1, legPos = "topleft", norm.by.nodes = FALSE)
plot(tab3, row.num = 2, col.num = 1, legPos = "topleft", norm.by.nodes = FALSE)
plot(tab3, row.num = 3, col.num = 1, legPos = "topleft", norm.by.nodes = FALSE)
plot(tab3, row.num = 1, col.num = 1, fun = "absolute", norm.by.nodes = FALSE)

## normed by number of nodes per layer
lF <- getLayerForest(getAncestryForest(rF))

layout(matrix(1:4, nrow = 2, byrow = TRUE))
plot(tab3, layerForest = lF, row.num = 1, col.num = 1, legPos = "topleft")
plot(tab3, layerForest = lF, row.num = 2, col.num = 1)
plot(tab3, layerForest = lF, row.num = 3, col.num = 1, legPos = "topleft")
plot(tab3, layerForest = lF, row.num = 1, col.num = 1, 
fun = "relative", legPos = "topleft")

adibender/rFtools documentation built on May 14, 2019, 5:13 a.m.