Package 'elliplot'

Title: Ellipse Summary Plot of Quantiles
Description: Correlation chart of two set (x and y) of data. Using Quantiles. Visualize the effect of factor.
Authors: Shinichiro Tomizono
Maintainer: Shinichiro Tomizono <[email protected]>
License: MIT + file LICENSE
Version: 1.3.0
Built: 2024-11-21 05:05:01 UTC
Source: https://github.com/cran/elliplot

Help Index


Ellipse Summary Plot of Quantiles

Description

Correlation chart of two set (x and y) of data. Using Quantiles. Visualize the effect of factor.

Details

The DESCRIPTION file:

Package: elliplot
Type: Package
Title: Ellipse Summary Plot of Quantiles
Version: 1.3.0
Date: 2022-04-19
Author: Shinichiro Tomizono
Maintainer: Shinichiro Tomizono <[email protected]>
Description: Correlation chart of two set (x and y) of data. Using Quantiles. Visualize the effect of factor.
Depends: methods
License: MIT + file LICENSE
NeedsCompilation: no
Packaged: 2022-04-19 09:27:49 UTC; nara
Date/Publication: 2022-04-19 10:32:30 UTC
Repository: https://osubera.r-universe.dev
RemoteUrl: https://github.com/cran/elliplot
RemoteRef: HEAD
RemoteSha: 4866fa12a7e5b6a879fbdf968923ae6c3ac878fb

Index of help topics:

elliplot-package        Ellipse Summary Plot of Quantiles
ellipseplot             Draw Ellipse Summary Plot
midpoint                Center of Indexes
midpoints               Quantile Summaries
ninenum                 Nine Number Summaries
seventeennum            Seventeen Number Summaries

This package contains quantile functions and ellipse plot functions. These functions are to calculate quantile summaries and visualize them with ellipses.

The ellipseplot works both for 1 set and 2 sets of data. When used for 2 sets data, it visualize the correlation of x and y axis.

Author(s)

Shinichiro Tomizono

Maintainer: Shinichiro Tomizono <[email protected]>

References

Quantiles: https://tomizonor.wordpress.com/2013/04/28/quantiles-octiles/
Ellipse Plot: https://tomizonor.wordpress.com/2013/04/29/ellipse-plot/

See Also

midpoints, ellipseplot.

Examples

ninenum(1:999)
ellipseplot(iris[c(5,1)], iris[c(5,2)])

Draw Ellipse Summary Plot

Description

Correlation chart of two set (x and y) of data. Using Quantiles. Visualize the effect of factor.

Usage

ellipseplot(x, ...)

## Default S3 method:
ellipseplot(x, y=NULL, SUMMARY=ninenum, SHEER=sheer.color,
            plot=TRUE, verbose=FALSE, ...)

Arguments

x

An x-axis data, such as data frame of factors (1st column) and observations (2nd column). A vector, a matrix or a list is also acceptable. If a vector is given, a single ellipse without factors are drawn. A matrix is as same format as the data frame. A list is formed by factors with observatoin vectors as each item.

y

A y-axis data, such as data frame of factors (1st column) and observations (2nd column). Same types as the x-axis data are also acceptable. It can be a NULL (default), to draw a single axis chart.

SUMMARY

A function generating quantile summaries to write contours of ellipses. The default is ninenum to use nine number summary. The function must return an odd length numerical vector, because a center, such as median, is required.

SHEER

A function adjusting color levels of ellipses. The default is sheer.color function shown below.

sheer.color <- function(col, level) {
  sheer <- level^2 * 0.5
  adjustcolor(col, alpha.f=sheer)
}
    
plot

If FALSE is given, it disable to plot and print a summary. The default is TRUE.

verbose

If TRUE is given, it print verbose debugging information. The default is FALSE.

...

Plot parameters are acceptable.

Details

This function is designed to visualize a correlation between 2 sets of independent observation with common factors. Such as, the plant height v.s. the soil pH by location.

Value

A summary list is explicitly printed when plot=FALSE is given, and is invisibly returned when plot=TRUE.

Author(s)

Shinichiro Tomizono

References

Ellipse Summary Plot https://tomizonor.wordpress.com/2013/04/29/ellipse-plot/

See Also

ninenum, seventeennum, midpoints.

Examples

# iris data: Sepal.Length v.s. Sepal.Width by Species
ellipseplot(iris[c(5,1)], iris[c(5,2)])

# PlantGrowth data: weight by group : single axis
# five number summaries are used.  
# similar to boxplot(weight~group,PlantGrowth)
ellipseplot(PlantGrowth[2:1], SUMMARY=fivenum)

# iris data: Sepal.Length v.s. Sepal.Width without factor
ellipseplot(iris[,1], iris[,2], xlab='Sepal.Length', ylab='Sepal.Width')

# list example
ellipseplot(list(untreated=rnorm(30,3,1), treated=rnorm(30,5,2)), 
            list(untreated=rnorm(20,6,3), treated=rnorm(20,4,2)))

# using cutomized sheer function
my.sheer.color <- function(col, level) adjustcolor(rainbow(100)[runif(1,1,100)], alpha.f=0.4)
ellipseplot(iris[c(5,1)], iris[c(5,2)], SHEER=my.sheer.color)

Center of Indexes

Description

Divide a given range of index into two of exact halves.

Usage

midpoint(x)

Arguments

x

range of index. c(min.index, max.index)

Details

This function implements the concept of median, and is used in the midpoints to calculate quantiles.

Value

A list of two numeric vectors is returned.

[[1]]

a range of index for the lower half

[[2]]

a range of index for the higher half

Lengths of the two halves are exactly same. If the parent range has an odd length, the exact center index is used both at the end of the lower half and at the start of the higher half.

Author(s)

Shinichiro Tomizono

References

Quantiles: median, quartiles, octiles, hexadeciles, ... https://tomizonor.wordpress.com/2013/04/28/quantiles-octiles/

See Also

midpoints, median, range.

Examples

midpoint(c(2,8))
# results are shown below.
# [[1]]
# [1] 2 5
# 
# [[2]]
# [1] 5 8

midpoint(c(2,9))
# results are shown below.
# [[1]]
# [1] 2 5
# 
# [[2]]
# [1] 6 9

Quantile Summaries

Description

Return quantile summary (minimum, quantiles, maximum) for the input data.

Usage

midpoints(x, n = 1, na.rm = TRUE)

Arguments

x

numeric, maybe including NAs and +/-Infs.

n

positive integer, to determine which quantiles to calculate. return values are 2n+12 ^ n + 1 number summary. n=1 (default) is for three number, namely, minimum, median and maximum. n=2 is for five number, such as quartiles. n=3 is for nine number, such as octiles.

na.rm

logical value indicating whether NAs should be stripped before the computation proceeds.

Details

This function is calling midpoint with n depth.

Value

A numeric vector of length 2n+12 ^ n + 1 containing the summary information.

Author(s)

Shinichiro Tomizono

References

Quantiles: median, quartiles, octiles, hexadeciles, ... https://tomizonor.wordpress.com/2013/04/28/quantiles-octiles/

See Also

midpoint, seventeennum, ninenum, fivenum, median.

Examples

midpoints(1:100, 4)
midpoints(c(rnorm(100), -Inf, Inf), 3)

# define 33 number summary
thirtythreenum <- function(x, ...) midpoints(x, 5, ...)
thirtythreenum(1:100)

Nine Number Summaries

Description

Return nine number summary (minimum, 1st-3rd octiles, median, 5th-7th octiles, maximum) for the input data.

Usage

ninenum(x, na.rm=TRUE)

Arguments

x

numeric, maybe including NAs and +/-Infs.

na.rm

logical value indicating whether NAs should be stripped before the computation proceeds.

Details

This function is similar to fivenum. This returns octiles instead of quartiles of the fivenum.

Value

A numeric vector of length 9 containing the summary information.

Note

Internally calling midpoints with n=3.

Author(s)

Shinichiro Tomizono

References

Quantiles: median, quartiles, octiles, hexadeciles, ... https://tomizonor.wordpress.com/2013/04/28/quantiles-octiles/

See Also

midpoints, seventeennum, fivenum, median.

Examples

ninenum(1:100)
ninenum(c(rnorm(100), -Inf, Inf))

Seventeen Number Summaries

Description

Return seventeen number summary (minimum, 1st-7th hexadeciles, median, 9th-15th hexadeciles, maximum) for the input data.

Usage

seventeennum(x, na.rm=TRUE)

Arguments

x

numeric, maybe including NAs and +/-Infs.

na.rm

logical value indicating whether NAs should be stripped before the computation proceeds.

Details

This function is similar to fivenum. This returns hexadeciles instead of quartiles of the fivenum.

Value

A numeric vector of length 17 containing the summary information.

Note

Internally calling midpoints with n=4.

Author(s)

Shinichiro Tomizono

References

Quantiles: median, quartiles, octiles, hexadeciles, ... https://tomizonor.wordpress.com/2013/04/28/quantiles-octiles/

See Also

midpoints, ninenum, fivenum, median.

Examples

seventeennum(1:100)
seventeennum(c(rnorm(100), -Inf, Inf))