chart.QQPlot: Plot a QQ chart in PerformanceAnalytics: Econometric Tools for Performance and Risk Analysis (2024)

In PerformanceAnalytics: Econometric Tools for Performance and Risk Analysis

Description Usage Arguments Details Author(s) References See Also Examples

Description

Plot the return data against any theoretical distribution.

Usage

 1 2 3 4 5 6 7 8 910111213141516171819202122232425
chart.QQPlot( R, distribution = "norm", ylab = NULL, xlab = paste(distribution, "Quantiles"), main = NULL, las = par("las"), envelope = FALSE, labels = FALSE, col = c(1, 4), lwd = 2, pch = 1, cex = 1, line = c("quartiles", "robust", "none"), element.color = "darkgray", cex.axis = 0.8, cex.legend = 0.8, cex.lab = 1, cex.main = 1, xaxis = TRUE, yaxis = TRUE, ylim = NULL, distributionParameter = NULL, ...)

Arguments

R

an xts, vector, matrix, data frame, timeSeries or zoo object ofasset returns

distribution

root name of comparison distribution - e.g., 'norm' forthe normal distribution; 't' for the t-distribution. See examples for otherideas.

ylab

set the y-axis label, as in plot

xlab

set the x-axis label, as in plot

main

set the chart title, same as in plot

las

set the direction of axis labels, same as in plot

envelope

confidence level for point-wise confidence envelope, orFALSE for no envelope.

labels

vector of point labels for interactive point identification,or FALSE for no labels.

col

color for points and lines; the default is the secondentry in the current color palette (see 'palette' and 'par').

lwd

set the line width, as in plot

pch

symbols to use, see also plot

cex

symbols to use, see also plot

line

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

element.color

provides the color for drawing chart elements, such asthe box lines, axis lines, etc. Default is "darkgray"

cex.axis

The magnification to be used for axis annotation relative tothe current setting of 'cex'

cex.legend

The magnification to be used for sizing the legendrelative to the current setting of 'cex'

cex.lab

The magnification to be used for x- and y-axis labelsrelative to the current setting of 'cex'

cex.main

The magnification to be used for the main title relative tothe current setting of 'cex'.

xaxis

if true, draws the x axis

yaxis

if true, draws the y axis

ylim

set the y-axis limits, same as in plot

distributionParameter

a string of the parameters of the distributione.g., distributionParameter = 'location = 1, scale = 2, shape = 3, df = 4' for skew-T distribution

...

any other passthru parameters to the distribution function

Details

A Quantile-Quantile (QQ) plot is a scatter plot designed to compare the datato the theoretical distributions to visually determine if the observationsare likely to have come from a known population. The empirical quantiles areplotted to the y-axis, and the x-axis contains the values of the theoricalmodel. A 45-degree reference line is also plotted. If the empirical datacome from the population with the choosen distribution, the points shouldfall approximately along this reference line. The larger the departure fromthe reference line, the greater the evidence that the data set have comefrom a population with a different distribution.

Author(s)

John Fox, ported by Peter Carl

References

main code forked/borrowed/ported from the excellent:
Fox,John (2007) car: Companion to Applied Regression
http://socserv.socsci.mcmaster.ca/jfox/

See Also

qqplot
qq.plot
plot

Examples

 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
library(MASS) library(PerformanceAnalytics)data(managers)x = checkData(managers[,2, drop = FALSE], na.rm = TRUE, method = "vector")# Panel 1: Normal distributionchart.QQPlot(x, main = "Normal Distribution",line=c("quartiles"), distribution = 'norm', envelope=0.95)# Panel 2, Log-Normal distributionfit = fitdistr(1+x, 'lognormal')chart.QQPlot(1+x, main = "Log-Normal Distribution", envelope=0.95, distribution='lnorm',distributionParameter='meanlog = fit$estimate[[1]],  sdlog = fit$estimate[[2]]')## Not run: # Panel 3: Mixture Normal distributionlibrary(nor1mix)obj = norMixEM(x,m=2)chart.QQPlot(x, main = "Normal Mixture Distribution",line=c("quartiles"), distribution = 'norMix', distributionParameter='obj',envelope=0.95)# Panel 4: Symmetric t distributionlibrary(sn)n = length(x)fit.tSN = st.mple(as.matrix(rep(1,n)),x,symmetr = TRUE)names(fit.tSN$dp) = c("location","scale","dof")round(fit.tSN$dp,3)chart.QQPlot(x, main = "MO Symmetric t-Distribution QQPlot",xlab = "quantilesSymmetricTdistEst",line = c("quartiles"),envelope = .95, distribution = 't', distributionParameter='df=fit.tSN$dp[3]',pch = 20)# Panel 5: Skewed t distributionfit.st = st.mple(as.matrix(rep(1,n)),x)# fit.st = st.mple(y=x) Produces same result as line abovenames(fit.st$dp) = c("location","scale","skew","dof")round(fit.st$dp,3)chart.QQPlot(x, main = "MO Returns Skewed t-Distribution QQPlot",xlab = "quantilesSkewedTdistEst",line = c("quartiles"),envelope = .95, distribution = 'st',distributionParameter = 'xi = fit.st$dp[1],omega = fit.st$dp[2],alpha = fit.st$dp[3],nu=fit.st$dp[4]',pch = 20)# Panel 6: Stable Parietianlibrary(fBasics)fit.stable = stableFit(x,doplot=FALSE)chart.QQPlot(x, main = "Stable Paretian Distribution", envelope=0.95, distribution = 'stable', distributionParameter = 'alpha = fit(stable.fit)$estimate[[1]],  beta = fit(stable.fit)$estimate[[2]],  gamma = fit(stable.fit)$estimate[[3]],  delta = fit(stable.fit)$estimate[[4]], pm = 0')## End(Not run)#end examples

PerformanceAnalytics documentation built on Feb. 6, 2020, 5:11 p.m.

Related to chart.QQPlot in PerformanceAnalytics...

PerformanceAnalytics index

Package overview README.md Estimation of Higher Order Moments How to Present Tables in Plot Devices PerformanceAnalytics Charts and Tables Presentation - Meielisalp - 2007 PerformanceAnalytics Charts and Tables Reference PerformanceAnalytics Data Mining Presentation - UseR - 2007 Performance Attribution from Bacon Portfolio Returns **PerformanceAnalytics** Plotting Using Additional Plotting Engines

chart.QQPlot: Plot a QQ chart in PerformanceAnalytics: Econometric Tools for Performance and Risk Analysis (2024)

FAQs

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

A QQ plot is a scatterplot created by plotting two sets of quantiles against one another. If both sets of quantiles came from the same distribution, we should see the points forming a line that's roughly straight.

What is the Q-Q plot in regression? ›

A Q-Q plot can be used in regression models to check some of the assumptions that are required for valid inference. For example, you can use a Q-Q plot to check if the residuals of the model are normally distributed, which is an assumption for many parametric tests and confidence intervals.

How to use Q-Q plot to test normality? ›

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 difference between Q-Q plot and Prob plot? ›

A Q-Q (Quantile-Quantile) plot is another graphic method for testing whether a dataset follows a given distribution. It differs from the probability plot in that it shows observed and expected values instead of percentages on the X and Y axes.

What is the math behind Q-Q plot? ›

If the two distributions being compared are identical, the Q–Q plot follows the 45° line y = x. If the two distributions agree after linearly transforming the values in one of the distributions, then the Q–Q plot follows some line, but not necessarily the line y = x.

How does Q-Q plot indicate skewness? ›

Q-Q plots are also used to find the skewness (a measure of asymmetry) of a distribution. When we plot theoretical quantiles on the x-axis and the sample quantiles whose distribution we want to know on the y-axis, then we see a very peculiar shape of a normally distributed Q-Q plot for skewness.

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.

What is the Q-Q plot used to formally test? ›

Answer and Explanation:

If the ordered values fall on a straight line on the q-q plot, then it is assumed that the data come from normally distributed populations. The plot is used to formally test the null hypothesis that data are normally distributed.

What is a Q-Q plot for multivariate normal? ›

Q-Q Plot for Evaluating Multivariate Normality and Outliers

The basic idea is the same as for a normal probability plot. For multivariate data, we plot the ordered Mahalanobis distances versus estimated quantiles (percentiles) for a sample of size n from a chi-squared distribution with p degrees of freedom.

How do you explain a Q-Q plot? ›

Technically speaking, a Q-Q plot compares the distribution of two sets of data. In most cases, a probability plot will be most useful. A probability plot compares the distribution of a data set with a theoretical distribution. The R function qqnorm( ) compares a data set with the theoretical normal distibution.

What are the disadvantages of Q-Q plot? ›

Quantile-Quantile (Q-Q) plots are often difficult to interpret because it is unclear how large the deviation from the theoretical distribution must be to indicate a lack of fit.

Why is Q-Q plot better than histogram? ›

QQ-Plots are a more robust test for normality and provide visual feedback on the nature of the data. It is also recommended to histogram the data to see if it appears normal. If the points in the Q-Q plot are on a line from the lower left to the upper right then the data is basically normally distributed.

What is the Q-Q plot of a box plot? ›

The Q-Q boxplot is an amalgam of the boxplot and the Q-Q plot and allows the user to rapidly examine summary statistics and tail behavior for multiple distributions in the same pane. As an extension of the 'ggplot2' implementation of the boxplot, possible modifications to the boxplot extend to the Q-Q boxplot.

What does the slope of a Q-Q plot mean? ›

The slope of the Q-Q plot reflects the ratio of the standard deviation of your data to the standard deviation of the normal distribution. If the slope is greater than 1, it means that your data are more spread out than the normal distribution, and vice versa.

Top Articles
Basic Italian Meringue Recipe
Blessings
Hotels Near 6491 Peachtree Industrial Blvd
The Largest Banks - ​​How to Transfer Money With Only Card Number and CVV (2024)
Brady Hughes Justified
Occupational therapist
PRISMA Technik 7-10 Baden-Württemberg
Encore Atlanta Cheer Competition
Minn Kota Paws
Where's The Nearest Wendy's
Detroit Lions 50 50
Goldsboro Daily News Obituaries
Wordscape 5832
Troy Athens Cheer Weebly
Dr. med. Uta Krieg-Oehme - Lesen Sie Erfahrungsberichte und vereinbaren Sie einen Termin
Teenleaks Discord
Brett Cooper Wikifeet
Inside the life of 17-year-old Charli D'Amelio, the most popular TikTok star in the world who now has her own TV show and clothing line
Palm Springs Ca Craigslist
MLB power rankings: Red-hot Chicago Cubs power into September, NL wild-card race
Lista trofeów | Jedi Upadły Zakon / Fallen Order - Star Wars Jedi Fallen Order - poradnik do gry | GRYOnline.pl
Lowes Undermount Kitchen Sinks
Scout Shop Massapequa
Busted Mcpherson Newspaper
Morse Road Bmv Hours
Www.paystubportal.com/7-11 Login
T Mobile Rival Crossword Clue
Elbert County Swap Shop
Shoe Station Store Locator
Criterion Dryer Review
What Sells at Flea Markets: 20 Profitable Items
Unity Webgl Car Tag
Ullu Coupon Code
Keshi with Mac Ayres and Starfall (Rescheduled from 11/1/2024) (POSTPONED) Tickets Thu, Nov 1, 2029 8:00 pm at Pechanga Arena - San Diego in San Diego, CA
Restored Republic
Mia Malkova Bio, Net Worth, Age & More - Magzica
47 Orchid Varieties: Different Types of Orchids (With Pictures)
Serenity Of Lathrop - Manteca Photos
Gwu Apps
Craigslist Georgia Homes For Sale By Owner
Myanswers Com Abc Resources
Pokemon Reborn Locations
Wo ein Pfand ist, ist auch Einweg
This 85-year-old mom co-signed her daughter's student loan years ago. Now she fears the lender may take her house
Mbfs Com Login
Toomics - Die unendliche Welt der Comics online
20 Mr. Miyagi Inspirational Quotes For Wisdom
RubberDucks Front Office
This Doctor Was Vilified After Contracting Ebola. Now He Sees History Repeating Itself With Coronavirus
Ups Customer Center Locations
Craigslist Farm And Garden Missoula
Wayward Carbuncle Location
Latest Posts
Article information

Author: Gregorio Kreiger

Last Updated:

Views: 5987

Rating: 4.7 / 5 (77 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Gregorio Kreiger

Birthday: 1994-12-18

Address: 89212 Tracey Ramp, Sunside, MT 08453-0951

Phone: +9014805370218

Job: Customer Designer

Hobby: Mountain biking, Orienteering, Hiking, Sewing, Backpacking, Mushroom hunting, Backpacking

Introduction: My name is Gregorio Kreiger, I am a tender, brainy, enthusiastic, combative, agreeable, gentle, gentle person who loves writing and wants to share my knowledge and understanding with you.