Description Usage Arguments Details Value See Also Examples
Compute data necessary to plot a quantile comparison plot (qq-plot).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | qq_data(
y,
data = NULL,
distribution = "norm",
...,
line = c("quartiles", "robust", "int=0,slope=1", "0,1", "none"),
envelope = 0.95,
method = c("mle-normal", "trimmed-normal", "moment-normal", "any"),
labels = NULL,
groups = NULL,
sep = " | "
)
## S3 method for class 'qqdata'
coef(object, ...)
## S3 method for class 'qqdata'
plot(x, ..., use_colors = FALSE, scales = "free")
|
y |
(formula|numeric|character)
|
data |
(data frame| |
distribution |
root name of comparison distribution – e.g., |
... |
Parameters to be passed to function, selected in |
line |
(string) A parameter, that controls how reference line is drawn. Options:
|
envelope |
(numeric | |
method |
(string:
|
groups |
( |
sep |
(not used yet). |
object |
A |
x |
A |
use_colors |
(logical) use colors for multiple groups |
scales |
("free"|"free_x"|"free_y"|"fixed")
a parmeter to be passed to
|
Function qq_data
is inspired by qqPlot()
in package car
(writen by J. Fox).
An object, which inherits from classes qqdata
and
data.frame
. The object contains information, needed
to plot a qqplot with reference line and its confidence intervals.
These variables are contained:
x – x axis values;
y – y axis values for points of qq plot;
labels – labels for each point;
ref_y – y axis values for reference line
ref_ci_upper and ref_ci_lower – y axis values for upper and lower pointwise confidence interval of a reference line.
car::qqPlot()
in car package,
stats::qqplot()
in stats package.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | library(biostat)
data(chickwts, package = "datasets")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Input as formula + data:
my_qq_df <- qq_data(~weight, data = chickwts)
head(my_qq_df)
coef(my_qq_df)
# Column ".group" is added if applied by group:
my_qq_df <- qq_data(weight ~ feed, data = chickwts)
head(my_qq_df)
coef(my_qq_df)
qq_plot(weight ~ feed, data = chickwts)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Input as variable name + data:
my_qq_df <- qq_data("weight", data = chickwts)
head(my_qq_df)
coef(my_qq_df)
my_qq_df <- qq_data("weight", groups = "feed", data = chickwts)
head(my_qq_df)
coef(my_qq_df)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Input as vector
my_qq_df <- qq_data(chickwts$weight)
head(my_qq_df)
coef(my_qq_df)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Input as vector, several groups.
# Column ".group" is added
my_qq_df <- qq_data(chickwts$weight, groups = chickwts$feed)
head(my_qq_df)
coef(my_qq_df)
library(biostat)
data(chickwts, package = "datasets")
# Input as formula + data:
my_qq_df <- qq_data(weight ~ feed, data = chickwts)
plot(my_qq_df)
my_qq_df2 <- qq_data(weight ~ feed, data = chickwts, method = "moment-normal")
plot(my_qq_df2)
my_qq_df3 <- qq_data(weight ~ feed, data = chickwts, method = "any")
plot(my_qq_df3)
# The same x and y scale limits for all plots
plot(my_qq_df, scales = "fixed")
# Plot in color
plot(my_qq_df, use_colors = TRUE)
# Plot a qq-plot (with no grouping)
qq_single <- qq_data(~weight, data = chickwts)
plot(qq_single)
class(qq_single)
# More than one grouping variable
data(CO2, package = "datasets")
qq_co2 <- qq_data(uptake ~ Type + Treatment, data = CO2)
plot(qq_co2)
qq_co2_B <- qq_data(uptake ~ Type + Treatment, data = CO2, line = "robust")
plot(qq_co2_B)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.