How to set x and y limits for qqplot using car package in R
In this article, we are going to know how to set x and y limits for qqplot using car package in the R programming language.
The “car” package in R, which defines Companion to Applied Regression is used to perform regressive tests as well as data visualizations. It is also used to carry out data transformations. The package can be installed into the working space using the following command :
A vector of x and y coordinates can be specified to define the points in the R working space. The qqplot() method in the “car” package can then be invoked to construct a graph of the coordinates. The quantile-quantile plot, also referred to as the probability plot can be constructed using this package. It specified the x and y coordinates of the points to be plotted.
Syntax: qqplot(x , y)
- x – numeric vector of observations of x.
- y – numeric vector of observations of y.
In this example, we are plotting the quartile-quartile graph using qqplot() function. firstly we are storing the x and y coordinates using a vector and then printing the graph using qqplot(). The qqplot() method access the coordinates by default based on the values of the data points and make the x and y axis scale according to them.
In this example, we are plotting the Q-Q plot as in the first example but extra work going to do in this example is to make a customized scale, and set the x and y axes limits respectively, and the xlim and ylim parameters in qqplot() method can be added. The xlim and ylim arguments take a vector containing the start and end of the respective x and y axes to be plotted.
Please Login to comment...