Show Menu
Cheatography

Hypothesis Testing in R Cheat Sheet (DRAFT) by

abracadabra abracadabra

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Formulate the Hypothesis

Null Hypothesis H0
hypothesis that is being tested (and trying to be disproved)
Alternate Hypothesis H1
represents the altern­ative value

Hypothesis Testing for Mean of 1-Sample

one sample t-test (μ0 (given) is population mean; μ is computed sample mean)
H0 : μ = μ0, H1 : μ != μ0
t.test­(sa­mpl­e_v­ector , mu=pop­ula­tio­n_mean, altern­ati­ve=­”tw­o.s­ided”)
Compare p-value with 𝞪 to check if H0 is rejected or not; Check test-s­tat­istic z if H0 is true;
test for proportion (p (given) is population mean; μ is computed sample mean)
H0 : μ = p, H1 : μ != p
prop.t­est­(tr­ue_­pro­por­tion, n_prop­ortion, p=popu­lat­ion­_mean, altern­ative = ”less”)
Compare p-value with 𝞪 to check if H0 is rejected or not; Check test-s­tat­istic z if H0 is true;

Test for Normality

Quantile Quantile Plot
 
qqPlot­(ve­ctor)
Check curve of qqplot
Shapir­o-Wilks test
H0 : x = N(μ,σ) and H1 : x != N(μ,σ)
shapir­o.test
Check p-value obtained from the test is < 0.05 then we reject H0 and assume the data is not normally distri­buted.

Comparing Variances

Fisher’s F test
H0: the variances are the same; H1: they are different
var.te­st(­vec­torA, vectorB)
Check p-value; Check ratio if H0 is true.