# Statistical Power in t tests with Unequal Group Sizes

When performing Studentâ€™s t-test to compare difference in means between two group, it is a useful exercise to determine the effect of unequal sample sizes in the comparison groups on power. Large imbalances generally will not have adequate statistical power to detect even large effect sizes associated with a factor, leading to a high Type II error rate as shown in the figure below:

# Math Expressions with Facets in ggplot2

In this post I show how we can use $\LaTeX$ math expressions to label the panels in facets to produce the following plot:

# Heatmaps in R

In every statistical analysis, the first thing one should do is try and visualise the data before any modeling. In microarray studies, a common visualisation is a heatmap of gene expression data. In this post I simulate some gene expression data and visualise it using the pheatmap function from the pheatmap package in R. You will also need the mvrnorm function from the MASS library to simulate from a multivariate normal distribution, and the brewer.pal function from the RColorBrewer library for easier customization of colors.

# Contrasts in R

In this post I discuss how to create custom contrasts for factor variables in R. First lets create some simulated data. Create the data, and factor Disease status:

We want the following contrasts:

• Control versus all 4 diseases combined
• RA versus the combination of (SLE, Scleroderma, Myositis), leaving out the Controls