Learn R Programming

userfriendlyscience (version 0.1-2)

normalityAssessment: normalityAssessment

Description

This function can be used to assess whether a variable and the sampling distribution of its mean have an approximately normal distribution.

Usage

normalityAssessment(sampleVector, samples = 5000, digits=3,
                    samplingDistColor = "#2222CC",
                    normalColor = "#00CC00",
                    samplingDistLineSize = 2,
                    normalLineSize = 1,
                    xLabel.sampleDist = NULL,
                    yLabel.sampleDist = NULL,
                    xLabel.samplingDist = NULL,
                    yLabel.samplingDist = NULL)

Arguments

sampleVector
Numeric vector containing the sample data.
samples
Number of samples to use when constructing sampling distribution.
digits
Number of digits to use when printing results.
samplingDistColor
Color to use when drawing the sampling distribution.
normalColor
Color to use when drawing the standard normal curve.
samplingDistLineSize
Size of the line used to draw the sampling distribution.
normalLineSize
Size of the line used to draw the standard normal distribution.
xLabel.sampleDist
Label of x axis of the distribution of the sample.
yLabel.sampleDist
Label of y axis of the distribution of the sample.
xLabel.samplingDist
Label of x axis of the sampling distribution.
yLabel.samplingDist
Label of y axis of the sampling distribution.

Value

  • An object with several results, the most notably of which are:
  • plot.sampleDistHistogram of sample distribution
  • sw.sampleDistShapiro-Wilk normality test of sample distribution
  • ad.sampleDistAnderson-Darling normality test of sample distribution
  • ks.sampleDistKolmogorov-Smirnof normality test of sample distribution
  • kurtosis.sampleDistKurtosis for sample distribution
  • skewness.sampleDistSkewness for sample distribution
  • plot.samplingDistHistogram of sampling distribution
  • sw.samplingDistShapiro-Wilk normality test of sampling distribution
  • ad.samplingDistAnderson-Darling normality test of sampling distribution
  • ks.samplingDistKolmogorov-Smirnof normality test of sampling distribution
  • kurtosis.samplingDistKurtosis for sampling distribution
  • skewness.samplingDistSkewness for sampling distribution

Details

This function provides a number of normality tests and draws histograms of the sample data and the sampling distribution of the mean (most statistical tests assume the latter is normal, rather than the first; normality of the sample data guarantees normality of the sampling distribution of the mean, but if the sample size is sufficiently large, the sampling distribution of the mean is approximately normal even when the sample data are not normally distributed). Note that for the sampling distribution, the degrees of freedom are usually so huge that the normality tests, negligible deviations from normality will already result in very small p-values.

Examples

Run this code
normalityAssessment(rnorm(35));

Run the code above in your browser using DataLab