qqPlot function - RDocumentation (2024)

Description

Plots empirical quantiles of a variable, or of studentized residuals from a linear model, against theoretical quantiles of a comparison distribution. Includes options not available in the qqnorm function.

Usage

qqPlot(x, ...)

qqp(...)

# S3 method for defaultqqPlot(x, distribution="norm", groups, layout, ylim=range(x, na.rm=TRUE), ylab=deparse(substitute(x)), xlab=paste(distribution, "quantiles"), glab=deparse(substitute(groups)), main=NULL, las=par("las"), envelope=TRUE, col=carPalette()[1], col.lines=carPalette()[2], lwd=2, pch=1, cex=par("cex"), line=c("quartiles", "robust", "none"), id=TRUE, grid=TRUE, ...)

# S3 method for formulaqqPlot(formula, data, subset, id=TRUE, ylab, glab, ...)

# S3 method for lmqqPlot(x, xlab=paste(distribution, "Quantiles"), ylab=paste("Studentized Residuals(", deparse(substitute(x)), ")", sep=""), main=NULL, distribution=c("t", "norm"), line=c("robust", "quartiles", "none"), las=par("las"), simulate=TRUE, envelope=TRUE, reps=100, col=carPalette()[1], col.lines=carPalette()[2], lwd=2, pch=1, cex=par("cex"), id=TRUE, grid=TRUE, ...)

Value

These functions return the labels of identified points, unless a grouping factor is employed, in which case NULL is returned invisibly.

Arguments

x

vector of numeric values or lm object.

distribution

root name of comparison distribution -- e.g., "norm" for the normal distribution; t for the t-distribution.

groups

an optional factor; if specified, a QQ plot will be drawn for x within each level of groups.

layout

a 2-vector with the number of rows and columns for plotting by groups -- for example c(1, 3) for 1 row and 3 columns; if omitted, the number of rows and columns will be selected automatically; the specified number of rows and columns must be sufficient to accomodate the number of groups; ignored if there is no grouping factor.

formula

one-sided formula specifying a single variable to be plotted or a two-sided formula of the form variable ~ factor, where a QQ plot will be drawn for variable within each level of factor.

data

optional data frame within which to evaluage the formula.

subset

optional subset expression to select cases to plot.

ylim

limits for vertical axis; defaults to the range of x. If plotting by groups, a common y-axis is used for all groups.

ylab

label for vertical (empirical quantiles) axis.

xlab

label for horizontal (comparison quantiles) axis.

glab

label for the grouping variable.

main

label for plot.

envelope

TRUE (the default), FALSE, a confidence level such as 0.95, or a list specifying how to plot a point-wise confidence envelope (see Details).

las

if 0, ticks labels are drawn parallel to the axis; set to 1 for horizontal labels (see par).

col

color for points; the default is the first entry in the current car palette (see carPalette and par).

col.lines

color for lines; the default is the second entry in the current car palette.

pch

plotting character for points; default is 1 (a circle, see par).

cex

factor for expanding the size of plotted symbols; the default is 1.

id

controls point identification; if FALSE, no points are identified; can be a list of named arguments to the showLabels function; TRUE is equivalent to list(method="y", n=2, cex=1, col=carPalette()[1], location="lr"), which identifies the 2 points with the 2 points with the most extreme verical values --- studentized residuals for the "lm" method. Points labels are by default taken from the names of the variable being plotted is any, else case indices are used. Unlike most graphical functions in car, the default is id=TRUE to include point identification.

lwd

line width; default is 2 (see par).

line

"quartiles" to pass a line through the quartile-pairs, or "robust" for a robust-regression line; the latter uses the rlm function in the MASS package. Specifying line = "none" suppresses the line.

simulate

if TRUE calculate confidence envelope by parametric bootstrap; for lm object only. The method is due to Atkinson (1985).

reps

integer; number of bootstrap replications for confidence envelope.

...

arguments such as df to be passed to the appropriate quantile function.

grid

If TRUE, the default, a light-gray background grid is put on thegraph

Author

John Fox [email protected]

Details

Draws theoretical quantile-comparison plots for variables and for studentized residuals from a linear model. A comparison line is drawn on the plot either through the quartiles of the two distributions, or by robust regression.

Any distribution for which quantile and density functions exist in R (with prefixes q and d, respectively) may be used. When plotting a vector, the confidence envelope is based on the SEs of the order statistics of an independent random sample from the comparison distribution (see Fox, 2016). Studentized residuals from linear models are plotted against the appropriate t-distribution with a point-wise confidence envelope computed by default by a parametric bootstrap, as described by Atkinson (1985). The function qqp is an abbreviation for qqPlot.

The envelope argument can take a list with the following named elements; if an element is missing, then the default value is used:

level

confidence level (default 0.95).

style

one of "filled" (the default), "lines", or "none".

col

color (default is the value of col.lines).

alpha

transparency/opacity of a filled confidence envelope, a number between 0 and 1 (default 0.15).

border

controls whether a border is drawn around a filled confidence envelope (default TRUE).

References

Fox, J. (2016) Applied Regression Analysis and Generalized Linear Models, Third Edition. Sage.

Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition, Sage.

Atkinson, A. C. (1985) Plots, Transformations, and Regression. Oxford.

See Also

qqplot, qqnorm, qqline, showLabels

Examples

Run this code

x<-rchisq(100, df=2)qqPlot(x)qqPlot(x, dist="chisq", df=2, envelope=list(style="lines"))qqPlot(~ income, data=Prestige, subset = type == "prof")qqPlot(income ~ type, data=Prestige, layout=c(1, 3))qqPlot(lm(prestige ~ income + education + type, data=Duncan),envelope=.99)

Run the code above in your browser using DataLab

qqPlot function - RDocumentation (2024)

FAQs

QqPlot function - RDocumentation? ›

The qqPlot function is a modified version of the R functions qqnorm and qqplot . The EnvStats function qqPlot allows the user to specify a number of different distributions in addition to the normal distribution, and to optionally estimate the distribution parameters of the fitted distribution.

What is the function of the Q-Q plot? ›

The QQ plot, or quantile-quantile plot, is a graphical tool to help us assess if a set of data plausibly came from some theoretical distribution such as a normal or exponential.

What is the R function for Q-Q plot? ›

QQ plots can be made in R using a function called qqnorm(). Simply give the vector of data as input and it will draw a QQ plot for you. (qqline() will draw a line through that Q-Q plot to make the linear relationship easier to see.)

How does a Q-Q plot show normality? ›

Normally distributed data

The normal distribution is symmetric, so it has no skew (the mean is equal to the median). On a Q-Q plot normally distributed data appears as roughly a straight line (although the ends of the Q-Q plot often start to deviate from the straight line).

What is the Q-Q plot of residuals interpretation? ›

Use a Q-Q plot with standardized residuals from the model to assess normality visually. A Q-Q (quantile-quantile) plot shows how two distributions' quantiles line up, with our theoretical distribution (e.g., the normal distribution) as the x variable and our model residuals as the y variable.

What can we learn from Q-Q plot? ›

Q-Q plots are used to find the type of distribution for a random variable whether it be a Gaussian distribution, uniform distribution, exponential distribution or even a Pareto distribution. You can tell the type of distribution using the power of the Q-Q plot just by looking at it.

What is the function of QQ? ›

qq is a generic function used to show quantile-quantile plot. The function invokes particular methods which depend on the class of the first argument. So the function makes a quantile quantile plot for univariate POT models.

How to interpret a Q-Q plot? ›

Examining data distributions using QQ plots

Points on the Normal QQ plot provide an indication of univariate normality of the dataset. If the data is normally distributed, the points will fall on the 45-degree reference line. If the data is not normally distributed, the points will deviate from the reference line.

What is the Qqline function in R? ›

qqline adds a line to a “theoretical”, by default normal, quantile-quantile plot which passes through the probs quantiles, by default the first and third quartiles. qqplot produces a QQ plot of two datasets. Graphical parameters may be given as arguments to qqnorm , qqplot and qqline .

What does a Q-Q plot show linear regression? ›

Normal Q-Q Plot: This is used to assess if your residuals are normally distributed. basically what you are looking for here is the data points closely following the straight line at a 45% angle upwards (left to right).

What assumption does Q-Q plot show? ›

Let's start with the plot that is already familiar to us: the Normal Q-Q plot. We can use this plot to check for Assumption 3 (Normality). Aside from one outlier (observation 11), the dots follow the line very closely.

How to tell skewness from Q-Q plot? ›

Skewed Q-Q plots

Q-Q plots can find skewness(measure of asymmetry) of the distribution. If the bottom end of the Q-Q plot deviates from the straight line but the upper end is not, then the distribution is Left skewed(Negatively skewed).

What is the Q-Q plot for different distributions? ›

Q–Q plots can also be used as a graphical means of estimating parameters in a location-scale family of distributions. A Q–Q plot is used to compare the shapes of distributions, providing a graphical view of how properties such as location, scale, and skewness are similar or different in the two distributions.

How do you interpret PP plot and Q-Q plot? ›

A P-P plot compares the empirical cumulative distribution function of a data set with a specified theoretical cumulative distribution function F(·). A Q-Q plot compares the quantiles of a data distribution with the quantiles of a standardized theoretical distribution from a specified family of distributions.

What does a heavy-tailed Q-Q plot mean? ›

Heavy tailed qqplot: meaning that compared to the normal distribution there is much more data located at the extremes of the distribution and less data in the center of the distribution.

What is a Q-Q plot for dummies? ›

A q-q plot is a plot of the quantiles of the first data set against the quantiles of the second data set. By a quantile, we mean the fraction (or percent) of points below the given value. That is, the 0.3 (or 30%) quantile is the point at which 30% percent of the data fall below and 70% fall above that value.

What is the function for Q-Q plot in Matlab? ›

qqplot( x , y ) displays a quantile-quantile plot of the quantiles of the sample data x versus the quantiles of the sample data y . If the samples come from the same distribution, then the plot appears linear. qqplot(___, pvec ) displays a quantile-quantile plot with the quantiles specified in the vector pvec .

What is the purpose of the Q-Q plot in multiple regression? ›

Q-Q plots are graphical tools that help you assess the validity of some assumptions in regression models, such as normality, linearity, and hom*oscedasticity. In this article, you will learn how to create and interpret Q-Q plots using a simple example.

Top Articles
How Much Do Plumbers Make? (Statistics, Facts & FAQs) - Alpha Tradesmen Academy
Data Science Personal Statement Sample and Examples
Mybranch Becu
Durr Burger Inflatable
Craglist Oc
PRISMA Technik 7-10 Baden-Württemberg
Coindraw App
Poe Pohx Profile
Klustron 9
O'reilly's In Monroe Georgia
2022 Apple Trade P36
Oppenheimer & Co. Inc. Buys Shares of 798,472 AST SpaceMobile, Inc. (NASDAQ:ASTS)
About Goodwill – Goodwill NY/NJ
123 Movies Babylon
The Wicked Lady | Rotten Tomatoes
R Tiktoksweets
Blog:Vyond-styled rants -- List of nicknames (blog edition) (TouhouWonder version)
Pvschools Infinite Campus
Inevitable Claymore Wow
U/Apprenhensive_You8924
Clarksburg Wv Craigslist Personals
Eka Vore Portal
Walmart Double Point Days 2022
Midlife Crisis F95Zone
Roster Resource Orioles
Craigslist Appomattox Va
Lista trofeów | Jedi Upadły Zakon / Fallen Order - Star Wars Jedi Fallen Order - poradnik do gry | GRYOnline.pl
Wkow Weather Radar
Riversweeps Admin Login
Idle Skilling Ascension
Bra Size Calculator & Conversion Chart: Measure Bust & Convert Sizes
Afni Collections
Craigslist Sf Garage Sales
Homewatch Caregivers Salary
Mrstryst
Kokomo Mugshots Busted
Haley Gifts :: Stardew Valley
Admissions - New York Conservatory for Dramatic Arts
Jasgotgass2
Scarlet Maiden F95Zone
Gopher Hockey Forum
Shoecarnival Com Careers
Rocky Bfb Asset
2024-09-13 | Iveda Solutions, Inc. Announces Reverse Stock Split to be Effective September 17, 2024; Publicly Traded Warrant Adjustment | NDAQ:IVDA | Press Release
Candise Yang Acupuncture
Squalicum Family Medicine
Rise Meadville Reviews
Dlnet Deltanet
Missed Connections Dayton Ohio
Mike De Beer Twitter
Thrift Stores In Burlingame Ca
Varsity Competition Results 2022
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 5979

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.