Description Usage Arguments Value TODO References Examples
The QQ-plot in SPSS and R looks very different. The points
points and the QQ-line are positioned differently.
qqnorm_spss implements a version of the QQ-plot that resembles
the SPSS version. The function returns an object containing the
processed data. The output can be plotted using the function plot
and ggplot. The parameters that can be passed to the
plotting functions are documented in plot.qqnorm.spss and
ggplot.qqnorm.spss.
1 | qqnorm_spss(x, standardize = FALSE, method = 1, ties.method = "average")
|
x |
A numeric vector. |
standardize |
Whether the quantiles of the standardized values should be displayed. The default is to display the quantiles using the original data. |
method |
The method used to assign probabilties for the
ranks that are then converted into quantiles.
The following methods are implemented (see Castillo-Gutiérrez, Lozano-Aguilera,
& Estudillo-Martínez, 2012):
|
ties.method |
Method to assign ranks to ties. One of
|
An list object of class qqnorm.spss with the
following elements:
x |
The orginal data |
y |
Corresponding quantiles in original scaling |
x.std |
Standardized values |
y.std |
Corresponding quantiles for standardized values |
method.name |
Name of the method to assign probabilities to ranks |
ties.method |
Method to treat ties |
xname |
Name of the variable used to produce the plot |
Check output against SPSS results.
Castillo-Gutiérrez, S., Lozano-Aguilera, E., & Estudillo-Martínez, M. D. (2012). Selection of a Plotting Position for a Normal Q-Q Plot. R Script. Journal of Communication and Computer, 9(3), 243–250.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | require(ggplot2)
set.seed(0)
x <- sample(0:9, 100, rep=TRUE)
### SPSS like
# Standard QQ-plot
qq <- qqnorm_spss(x, 1)
plot(qq)
ggplot(qq)
qq <- qqnorm_spss(x, 1, standardize=TRUE)
plot(qq, l.col="red")
ggplot(qq, line=FALSE)
# Detrended QQ-plot (plottype=2)
plot(qq, plottype=2)
ggplot(qq, plottype=2)
### R
qqnorm(x, datax=TRUE)
qqline(x, datax=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.