Description Usage Arguments Details Value Author(s) Examples
View source: R/plot_residuals.r
This function allows you to plot the residuals of a chi-squared two-sample test to infer bins that differ significantly from expected values.
1 | plot_residuals(chisq)
|
chisq |
output from chi-squared two-sample test. |
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.
Returns an object of class ggplot.
Adam Waring - adam.waring@msdtc.ox.ac.uk
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.