Title: | Quantile-Quantile Plot with Several Gaussian Simulations |
---|---|
Description: | Plots a QQ-Norm Plot with several Gaussian simulations. |
Authors: | Matthias Salvisberg |
Maintainer: | Matthias Salvisberg <[email protected]> |
License: | GPL-2 | GPL-3 |
Version: | 3.1.1 |
Built: | 2025-03-12 03:43:36 UTC |
Source: | https://github.com/matthiassalvisberg/stmosim |
Plots a QQ plot of the variable x with nSim Gaussian simulations.
qqnormSim(x, nSim = 500, mOfVar = "mad", main = "Normal Q-Q Plot - SIM", xlab = "Theoretical Quantiles", ylab = "Sample Quantiles", qqnormCol = "black", qqnormPch = 1, qqlineCol = "#cdd2d015", qqlineLwd = 3) ## S4 method for signature 'lm' qqnormSim(x, nSim = 500, mOfVar = "mad", main = "Normal Q-Q Plot - SIM", xlab = "Theoretical Quantiles", ylab = "Sample Quantiles", qqnormCol = "black", qqnormPch = 1, qqlineCol = "#cdd2d015", qqlineLwd = 3) ## S4 method for signature 'numeric' qqnormSim(x, nSim = 500, mOfVar = "mad", main = "Normal Q-Q Plot - SIM", xlab = "Theoretical Quantiles", ylab = "Sample Quantiles", qqnormCol = "black", qqnormPch = 1, qqlineCol = "#cdd2d015", qqlineLwd = 3)
qqnormSim(x, nSim = 500, mOfVar = "mad", main = "Normal Q-Q Plot - SIM", xlab = "Theoretical Quantiles", ylab = "Sample Quantiles", qqnormCol = "black", qqnormPch = 1, qqlineCol = "#cdd2d015", qqlineLwd = 3) ## S4 method for signature 'lm' qqnormSim(x, nSim = 500, mOfVar = "mad", main = "Normal Q-Q Plot - SIM", xlab = "Theoretical Quantiles", ylab = "Sample Quantiles", qqnormCol = "black", qqnormPch = 1, qqlineCol = "#cdd2d015", qqlineLwd = 3) ## S4 method for signature 'numeric' qqnormSim(x, nSim = 500, mOfVar = "mad", main = "Normal Q-Q Plot - SIM", xlab = "Theoretical Quantiles", ylab = "Sample Quantiles", qqnormCol = "black", qqnormPch = 1, qqlineCol = "#cdd2d015", qqlineLwd = 3)
x |
a lm-object or a numeric vector. If it's a lm-object its residuals are plotted. |
nSim |
[optional] the number of simulations you like to add to the plot. |
mOfVar |
[optinal] a measure of variation. ("mad" or "sd") |
main |
[optional] an overall title for the plot. |
xlab |
[optional] a title for the x axis. |
ylab |
[optional] a title for the y axis. |
qqnormCol |
[optional] color of the obervations in the plot. |
qqnormPch |
[optional] point character of the observations in the plot. |
qqlineCol |
[optional] color of the simulations in the plot. |
qqlineLwd |
[optional] line width of the simulations. should not be higher than 3. |
Two estimators are required for the simulation of the normal distribution. Since the normal distribution is a two-parameter family distribution.
Default measure of location is the mean. Default measure of variation is the mad. This gives a robust estimation of the standard deviation even if there are outliers in the sample.
Likewise this can be changed with the parameter mOfVar
.
invisible(NULL)
Matthias Salvisberg <[email protected]>
the basic graph corresponds to qqnorm
## Not run: ######## qqnorm vs. qqnormSim ######## par(mfrow = c(1,2)) x<- rnorm(100) qqnorm(x) qqline(x) qqnormSim(x) par(mfrow = c(1,1)) ######## basic functionality/arguments ######## # The observations should behave like a simulation, # because the observations are sampled from a Gaussian distribution. qqnormSim(x = rnorm(100)) # If you don't feel comfortable with the mad as # measure of variation you can change it to the standard deviation. qqnormSim(x = rnorm(100), mOfVar = "sd") # On the first glance its obvious that this sample # doesn't originate from a Gaussian distribution due to the heavy tails. qqnormSim(x = rt(100,df = 4)) Reduce the simulation tracks from 500 to 50. (500 is default). Not recommended unless you have not enough computation power. qqnormSim(x = rnorm(100), nSim = 50) ######## graphical arguments ######## # set title and axes labels. qqnormSim(x = rnorm(100), main = "main title", xlab = "x-axis label", ylab = "y-axis label") # I don't recommend fancy colors, unless you need it for your corporate identity. qqnormSim(x = rnorm(100), qqnormCol = "#ff0000", qqnormPch = 16, qqlineCol = "greenyellow", qqlineLwd = 1) ## End(Not run)
## Not run: ######## qqnorm vs. qqnormSim ######## par(mfrow = c(1,2)) x<- rnorm(100) qqnorm(x) qqline(x) qqnormSim(x) par(mfrow = c(1,1)) ######## basic functionality/arguments ######## # The observations should behave like a simulation, # because the observations are sampled from a Gaussian distribution. qqnormSim(x = rnorm(100)) # If you don't feel comfortable with the mad as # measure of variation you can change it to the standard deviation. qqnormSim(x = rnorm(100), mOfVar = "sd") # On the first glance its obvious that this sample # doesn't originate from a Gaussian distribution due to the heavy tails. qqnormSim(x = rt(100,df = 4)) Reduce the simulation tracks from 500 to 50. (500 is default). Not recommended unless you have not enough computation power. qqnormSim(x = rnorm(100), nSim = 50) ######## graphical arguments ######## # set title and axes labels. qqnormSim(x = rnorm(100), main = "main title", xlab = "x-axis label", ylab = "y-axis label") # I don't recommend fancy colors, unless you need it for your corporate identity. qqnormSim(x = rnorm(100), qqnormCol = "#ff0000", qqnormPch = 16, qqlineCol = "greenyellow", qqlineLwd = 1) ## End(Not run)
With this package you can simulate several lines into the QQ-Norm Plot under the assumption of Gaussian distribution. If the realised observations lie inside of the simulations tracks there is the possibility that the observations stem from a Gaussian distribution. This can be very useful in residual analysis where you have to evaluate whether the model residuals fit the assumption of gaussian distributed terms or not.
———–<CHANGELOG>———–
——-< v3.1.1 - 2018-11-19 >——-
provide more (plot) arguments to the user.
updated documentation - added more expamples.
added BugReports argument in DESCRIPTION.
implemented all recommendations from RcppParallel package.
——-< v3.1 - 2018-11-13 >——-
Minor bug fixes, due to CHECK changes on CRAN.
Moved documentation to roxygen2.
——-< v3.0 - 2014-10-16 >——-
Computation intense code moved to C++.
Moved to parallel computation, thanks to Rcpp/RcppParallel !
Minor bug fixes.
——-< v2.2 - 2012-02-24 >——-
Minor bug fixes, due to CHECK changes on CRAN.
——-< v2.1 - 2012-02-24 >——-
Minor bug fixes.
——-<v2.0 - 2011-03-31 >——-
Moved to S4 Classes.
——-<v1.1 - 2010-05-03 >——-
First Version on CRAN.
———–</CHANGELOG>———–
Matthias Salvisberg <[email protected]>