Get startedGet started for free

Histogram of p-values

After performing the test, confirm that the model was properly specified by inspecting the distribution of p-values for each contrast. Recall that a uniform distribution of p-values is expected for a contrast with few differentially expressed genes, and a right skewed distribution is expected for a contrast with many differentially expressed genes.

This exercise is part of the course

Differential Expression Analysis with limma in R

View Course

Exercise instructions

The fitted model object fit2 has been loaded in your workspace. The limma package is already loaded.

  • Use topTable to obtain the summary statistics for every gene for the contrast "dox_wt". Set the number of genes to return equal the number of rows of fit2.

  • Repeat for the contrasts "dox_top2b" and "interaction".

  • Use hist to create a histogram of p-values for each of the three contrasts.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Obtain the summary statistics for the contrast dox_wt
stats_dox_wt <- ___(fit2, coef = ___, number = ___,
                         sort.by = "none")
# Obtain the summary statistics for the contrast dox_top2b
stats_dox_top2b <- ___(fit2, coef = ___, number = ___,
                            sort.by = "none")
# Obtain the summary statistics for the contrast interaction
stats_interaction <- ___(fit2, coef = ___, number = ___,
                              sort.by = "none")

# Create histograms of the p-values for each contrast
___(stats_dox_wt[___])
___(stats_dox_top2b[___])
___(stats_interaction[___])
Edit and Run Code