{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "tags": [ "remove-cell" ] }, "outputs": [], "source": [ "library(repr) ; options(repr.plot.res = 100, repr.plot.width=4, repr.plot.height= 4) # Change plot sizes (in cm) - this bit of code is only relevant if you are using a juyter notebook - ignore otherwise" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Basic hypothesis testing: $t$ and $F$ tests" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Introduction\n", "\n", "\n", "Aims of this chapter:\n", "\n", "* Using $t$ tests to look at differences between means\n", "\n", "* Using $F$ tests to compare the variance of two samples\n", "\n", "* Using non-parametric tests for differences\n", "\n", "## $t$ tests\n", "\n", "The $t$ test is used to compare the mean of a sample to another value, which can be: \n", "* Some reference point (Is the mean different from 5?) \n", "* Another mean (Does the mean of A differ from the mean of B?). \n", "\n", "If you have a factor with two levels then a $t$ test is a good way to compare the means of those samples. If you have more than two levels, then you have a problem: as the number of levels ($n$) increases, the number of possible comparisons between pairs of levels ($p$) increases very rapidly. The number of possible pairs is the binomial coefficient $C(n,2)$ — inevitably, R has a function for this (try it in R):" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "