In statistics, normality tests are used to determine if a data set is well-modeled by a normal distribution and to compute how likely it is for a random variable underlying the data set to be normally distributed.
a.q-q plot:quantile-quantile plot
set.seed(222)
x<-rnorm(30,0,1)
qqnorm(x, main = "Normal Q-Q Plot",
xlab = "Theoretical Normal Quantiles",
ylab = "Sample Normal Quantiles",pch=20)
qqline(x)
y<-rlnorm(30,0,1)
qqnorm(y, main = "Log-Normal Q-Q Plot",
xlab = "Theoretical Normal Quantiles",
ylab = "Sample Lognormal Quantiles",pch=20)
qqline(y)
qqplot(qlnorm(ppoints(1000)),y, main = "LogNormal Q-Q Plot",
xlab = "Theoretical LogNormal Quantiles",
ylab = "Sample Lognormal Quantiles",pch=20)
qqline(y, distribution = function(p) qlnorm(p,0,1),prob = c(0.1, 0.6))
b.p-p plot:probability-probability plot or percent-percent plot
x<-rnorm(30)
plot(ppoints(length(x)),pnorm(sort(x)),pch=20,xlab ='Theoretical cumulative distribution', ylab = "Empirical cumulative distribution")
abline(0,1)
library(StatDA)
## Warning: package 'StatDA' was built under R version 3.2.1
## Loading required package: geoR
## Warning: package 'geoR' was built under R version 3.2.1
## --------------------------------------------------------------
## Analysis of Geostatistical Data
## For an Introduction to geoR go to http://www.leg.ufpr.br/geoR
## geoR version 1.7-5.1 (built on 2015-04-15) is now loaded
## --------------------------------------------------------------
##
## Loading required package: sgeostat
## Warning: package 'sgeostat' was built under R version 3.2.1
ppplot.das(x, pdist = pnorm, xlab ='Theoretical cumulative distribution', ylab = "Empirical cumulative distribution", line = TRUE,pch=20)