plot_residuals: Plot for chi-squared residuals

Description Usage Arguments Details Value Author(s) Examples

View source: R/plot_residuals.r

Description

This function allows you to plot the residuals of a chi-squared two-sample test to infer bins that differ significantly from expected values.

Usage

1

Arguments

chisq

output from chi-squared two-sample test.

Details

This method plots residuals as a 2 x m table where m is the number of bins in the chisq.test.

Residuals are standardized by the standard deviation of the residuals. Within each cell of the table is a circle whose color and size relate to the size of the residual. Residuals that are significant at a nominal 0.05 (two-tailed) after Bonferonni correction are highlighted with an asterix.

Value

Returns an object of class ggplot.

Author(s)

Adam Waring - adam.waring@msdtc.ox.ac.uk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
nresidues = 1000 # length of the protein
probs = rexp(nresidues)^2
case_probs = probs * rep(c(1, 3, 1), c(200, 200, 600))
control_probs = probs * rep(c(2, 1, 2), c(200, 200, 600))

case_residues = sample(1:nresidues, 100, rep=T, case_probs)
control_residues = sample(1:nresidues, 100, rep=T, control_probs)

chisq = BIN_test(case_residues, control_residues)
plot_residuals(chisq)

adamwaring/ClusterBurden documentation built on July 29, 2020, 9:50 p.m.