Last data update: 2014.03.03

R: Asymmetry curve based on depths
asymmetryCurveR Documentation

Asymmetry curve based on depths

Description

Produces an asymmetry curve estimated from given data.

Usage

asymmetryCurve(x, y = NULL, alpha = seq(0, 1, 0.01),
  method = "Projection", movingmedian = FALSE, name = "X", name_y = "Y",
  ...)

Arguments

x

The data as a matrix or data frame. If it is a matrix or data frame, then each row is viewed as one multivariate observation.

y

Additional matrix of multivariate data.

alpha

An ordered vector containing indices of central regins used for asymmetry curve calculation.

method

Character string which determines the depth function used. The method can be "Projection" (the default), "Mahalanobis", "Euclidean", "Tukey" or 'LP'. For details see depth.

movingmedian

Logical. For default FALSE only one depth median is used to compute asymmetry norm. If TRUE - for every central area, a new depth median will be used - this approach needs much more time.

name

Name of set X - used in plot legend

name_y

Name of set Y - used in plot legend

...

Any additional parameters for function depth

Details

For sample depth function D({x},{{{Z}}^{n}}) , {x}in {{{R}}^{d}} , d≥ 2 , {Z}^{n}={{{{z}}_{1}},...,{{{z}}_{n}}}subset {{{R}}^{d}} , {{D}_{α }}({{{Z}}^{n}}) denoting α- central region, we can define the asymmetry curve AC(α )=≤ft( α ,≤ft| {{c}^{-1}}({{ar{z}}-med|{{D}_{α }}({{{Z}}^{n}})}) ight| ight)subset {{{R}}^{2}} , for α in [0,1] being nonparametric scale and asymmetry functional correspondingly, where c- denotes constant, {ar{z}}- denotes mean vector, denotes multivariate median induced by depth function and vol- denotes a volume.

Asymmetrycurve takes uses function convhulln from package geometry for computing a volume of convex hull containing central region.

Author(s)

Daniel Kosiorowski, Mateusz Bocian, Anna Wegrzynkiewicz and Zygmunt Zawadzki from Cracow University of Economics.

References

Serfling R. J. Multivariate Symmetry and Asymmetry, Encyclopedia of Statistical Science, S Kotz, C.B. Read, N. Balakrishnan, B. Vidakovic (eds), 2nd, ed., John Wiley.

Liu, R.Y., Parelius, J.M. and Singh, K. (1999), Multivariate analysis by data depth: Descriptive statistics, graphics and inference (with discussion), Ann. Statist., 27, 783–858.

Chaudhuri, P. (1996), On a Geometric Notion of Quantiles for Multivariate Data, Journal of the American Statistical Association, 862–872.

Dyckerhoff, R. (2004), Data Depths Satisfying the Projection Property, Allgemeines Statistisches Archiv., 88, 163–190.

See Also

scaleCurve, depth

Examples

#EXAMPLE 1
require(sn)
xi = c(0,0)
alpha <- c(2,-5)
Omega <- diag(2)*5

n = 500
X = mvrnorm(n, xi, Omega)  # normal distribution
Y = rmst(n, xi, Omega, alpha, nu=1)
asymmetryCurve(X,Y,name = "NORM",name_y = "S_T(2,-5,10)")


#EXAMPLE 2
data(under5.mort)
data(inf.mort)
data(maesles.imm)
data1990=cbind(under5.mort[,1],inf.mort[,1],maesles.imm[,1])
data2011=cbind(under5.mort[,22],inf.mort[,22],maesles.imm[,22])
as1990=asymmetryCurve(data1990,name='scale curve 1990')
as2011=asymmetryCurve(data2011,name='scale curve 2011')
figure=getPlot(as1990 %+% as2011)+ggtitle('Scale curves')
figure

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(DepthProc)
Loading required package: ggplot2
Loading required package: Rcpp
Loading required package: rrcov
Loading required package: robustbase
Scalable Robust Estimators with High Breakdown Point (version 1.3-11)

Loading required package: MASS
Loading required package: np
Nonparametric Kernel Methods for Mixed Datatypes (version 0.60-2)
[vignette("np_faq",package="np") provides answers to frequently asked questions]
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DepthProc/asymmetryCurve.Rd_%03d_medium.png", width=480, height=480)
> ### Name: asymmetryCurve
> ### Title: Asymmetry curve based on depths
> ### Aliases: asymmetryCurve
> ### Keywords: asymmetry depth function multivariate nonparametric robust
> 
> ### ** Examples
> 
> #EXAMPLE 1
> require(sn)
Loading required package: sn
Loading required package: stats4

Attaching package: 'sn'

The following object is masked from 'package:stats':

    sd

> xi = c(0,0)
> alpha <- c(2,-5)
> Omega <- diag(2)*5
> 
> n = 500
> X = mvrnorm(n, xi, Omega)  # normal distribution
> Y = rmst(n, xi, Omega, alpha, nu=1)
> asymmetryCurve(X,Y,name = "NORM",name_y = "S_T(2,-5,10)")
Object of class: AsymmetryCurveListWarning message:
Removed 99 rows containing missing values (geom_path). 
> 
> 
> #EXAMPLE 2
> data(under5.mort)
> data(inf.mort)
> data(maesles.imm)
> data1990=cbind(under5.mort[,1],inf.mort[,1],maesles.imm[,1])
> data2011=cbind(under5.mort[,22],inf.mort[,22],maesles.imm[,22])
> as1990=asymmetryCurve(data1990,name='scale curve 1990')
> as2011=asymmetryCurve(data2011,name='scale curve 2011')
> figure=getPlot(as1990 %+% as2011)+ggtitle('Scale curves')
> figure
Warning message:
Removed 147 rows containing missing values (geom_path). 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>