didacticPlot is useful for making ggplot2 plots of distributions of t, F, Chi^2, and Pearson r, showing a given value, and shading the arie covering the more extreme values. didacticPlotTheme is the basic theme.
didacticPlot(foundValue, statistic, df1, df2 = NULL,
granularity = 1000, xLim = NULL, yLab = NULL,
lineCol = "red", lineSize=1,
surfaceCol = "red", textMarginFactor = 20,
sided="two")
didacticPlotTheme(base_size = 14, base_family = "")
The value to indicate (the 'found' value).
One of "r", "t", "f" or "chisq".
The degrees of freedom; only use df1 for the r, t and chi^2 test; for the F-test, use df1 for the degrees of freedom of the denominator and df2 for the degrees of freedom of the numerator.
Steps to use for x-axis.
Vector; minimum and maximum values on x axis.
Label on y axis.
Colour of density line.
Size of density line.
Colour of coloured surface area.
Used to calculate how close to the vertical line text labels should appear.
Whether to make a plot for a 2-sided or 1-sided test.
Passed on to the grey ggplot theme.
didacticPlot returns an object that contains the plot in the $plot element.
# NOT RUN {
didacticPlot(1, statistic='chisq', df1=2);
didacticPlot(1, statistic='t', df1=40);
didacticPlot(2.02, statistic='t', df1=40, textMarginFactor=25);
### Two sample t-test for n1 = n2 = 250, showing
### p-value of 5%
# a<-didacticPlot(1.96, statistic='t', df1=498);
# }
Run the code above in your browser using DataLab