Title: | Ray Shooting Depth (i.e. RS Depth) Functions for Bivariate Analysis |
---|---|
Description: | Ray Shooting Depth functions are provided for bivariate analysis. This mainly includes functions for computing the bivariate depth as well as RS median. Drawing functions for depth bags are also provided. |
Authors: | Mudassir Shabbir [aut, cre], Nabil Mustafa [aut], Saurabh Ray [aut] |
Maintainer: | Mudassir Shabbir <[email protected]> |
License: | GPL-2 |
Version: | 0.1-22 |
Built: | 2025-02-18 05:56:26 UTC |
Source: | https://github.com/cran/rsdepth |
Computes Centroid of a convex polygon in plane.
centroid(x, y=NULL,...)
centroid(x, y=NULL,...)
x |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
y |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
... |
For future use. |
In dimension 2, calculates centroid of a convex polygon.
Returns with respect to data set, the centroid point in plane.
Nabil Mustafa, Saurabh Ray, and Mudassir Shabbir.
N. Mustafa, S. Ray, and M. Shabbir, Statistical Data Depth of Pointsets in the Plane,in prep..
## calculation of centroid of a random pointset z = matrix(rnorm(24),nc=2) x = centroid(z)
## calculation of centroid of a random pointset z = matrix(rnorm(24),nc=2) x = centroid(z)
Convex Hull of a pointset in plane.
convexhull(x, y=NULL,...)
convexhull(x, y=NULL,...)
x |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
y |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
... |
For future use. |
In dimension 2, calculates Convex Hull of a pointset.
Returns with respect to data set, ordered set of points on the convex hull.
Nabil Mustafa, Saurabh Ray, and Mudassir Shabbir.
N. Mustafa, S. Ray, and M. Shabbir, Statistical Data Depth of Pointsets in the Plane,in prep..
## calculation of centroid of a random pointset z = matrix(rnorm(24),nc=2) x = convexhull(z)
## calculation of centroid of a random pointset z = matrix(rnorm(24),nc=2) x = convexhull(z)
Draws Complete Graph of a pointset in plane.
drawcompletegraph(x, y=NULL,startcanvas=TRUE,...)
drawcompletegraph(x, y=NULL,startcanvas=TRUE,...)
x |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
y |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
startcanvas |
A boolean value to let the function whether there is already a plot that we want to use or create a new canvas. Be default set to TRUE. |
... |
For future use. |
In dimension 2, draws complete graph on a pointset.
Returns nothing.
Nabil Mustafa, Saurabh Ray, and Mudassir Shabbir.
N. Mustafa, S. Ray, and M. Shabbir, Statistical Data Depth of Pointsets in the Plane,in prep..
## calculation of centroid of a random pointset z = matrix(rnorm(24),nc=2) x = drawcompletegraph(z)
## calculation of centroid of a random pointset z = matrix(rnorm(24),nc=2) x = drawcompletegraph(z)
Computes the Ray Shooting depth ISO of a point with respect to a bivariate data set.
getbag(x, y=NULL, factorsecondbag=2,...)
getbag(x, y=NULL, factorsecondbag=2,...)
x |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
y |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
factorsecondbag |
Factor of the second bag. Takes integer values. By default set to 2. |
... |
For future use. |
In dimension 2, calculates ray shooting depth of a given point with respect to the point set. Time complexity of the simple algorithms implemented is O(n log n). ISO
Returns with respect to data set pt
, the number of line segments interested by a ray from , minimum over all rays. ISO
Nabil Mustafa, Saurabh Ray, and Mudassir Shabbir.
N. Mustafa, S. Ray, and M. Shabbir, Statistical Data Depth of Pointsets in the Plane,in prep..
## calculation of RS depth z = matrix(rnorm(24),nc=2) x = getbag(z)
## calculation of RS depth z = matrix(rnorm(24),nc=2) x = getbag(z)
Inflates a convex polygon
inflate(x, y=NULL, factor=2, ...)
inflate(x, y=NULL, factor=2, ...)
x |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
y |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
factor |
An integer by default set to 2. |
... |
For future use. |
In dimension 2, inflates a convex polygon
Returns nothing.
Nabil Mustafa, Saurabh Ray, and Mudassir Shabbir.
N. Mustafa, S. Ray, and M. Shabbir, Statistical Data Depth of Pointsets in the Plane,in prep..
## calculation of centroid of a random pointset z = matrix(rnorm(24),nc=2) x = convexhull(z) y= inflate(x)
## calculation of centroid of a random pointset z = matrix(rnorm(24),nc=2) x = convexhull(z) y= inflate(x)
Computes the Ray Shooting depth of a point with respect to a bivariate data set.
rsdepth(pt,q, ...)
rsdepth(pt,q, ...)
q |
Numerical vector whose depth is to be calculated. Data needs to be 2-dimensional. |
pt |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
... |
For future use. |
In dimension 2, calculates ray shooting depth of a given point with respect to the point set. Time complexity of the simple algorithms implemented is O(n log n).
Returns the exact depth of bivariate point q
with respect to data set pt
, the number of line segments interested by a ray from q
, minimum over all rays.
Nabil Mustafa, Saurabh Ray, and Mudassir Shabbir.
N. Mustafa, S. Ray, and M. Shabbir, Statistical Data Depth of Pointsets in the Plane,in prep..
## calculation of RS depth z = matrix(rnorm(24),nc=2) x = matrix(rnorm(2),nc=2) rsdepth(z, x)
## calculation of RS depth z = matrix(rnorm(24),nc=2) x = matrix(rnorm(2),nc=2) rsdepth(z, x)
Computes the Ray Shooting median of a bivariate data set.
rsmed(pt, eps=c(0),...)
rsmed(pt, eps=c(0),...)
pt |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one multivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). Only 2-dimensional data is acceptable in this version. |
eps |
eps is an optional parameter used for approximating a median in case of large data sets. It takes valye of a real between 0 and 1 and is by default set to 0 which means no approximation is used if eps is not given. |
... |
Reserved for future use. |
Finds out the an arbitrary point among the Ray Shooting median set of given point set. Current uses the brute-force algorithm on all O(n^4) possible points
in the arrangment of all possible lines in complete graph on pt
. For each point O(n log n) is used to find out depth so overall complexity of this algorithm is O(n^5 log n).
When approximation parameter is provided then algorithm tries to approximate by finding median of a uniform sample subset of pt of size 1/eps^2*log(1/eps). If this constant is more than the size of original set then eps value is ignored and exact median is calculate on original point set.
A point in two dimension is returned as a single row two column vector
Nabil Mustafa, Saurabh Ray, and Mudassir Shabbir.
N. Mustafa, S. Ray, and M. Shabbir, Statistical Data Depth of Pointsets in the Plane,in prep..
rsdepth
for depth function
## RS median of a two-dimensional data set set.seed(617) zz <- matrix(rnorm(120), nc = 2) rsmed(zz,eps=0.2)
## RS median of a two-dimensional data set set.seed(617) zz <- matrix(rnorm(120), nc = 2) rsmed(zz,eps=0.2)
Computes the Ray Shooting depth ISO of a point with respect to a bivariate data set.
rsplot(x, y=NULL, factorsecondbag=2,mring=T,...)
rsplot(x, y=NULL, factorsecondbag=2,mring=T,...)
x |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
y |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). |
factorsecondbag |
Factor for second bag set to 2 by default. |
mring |
Boolean value set to TRUE by default. |
... |
For future use. |
In dimension 2, calculates ray shooting depth of a given point with respect to the point set. Time complexity of the simple algorithms implemented is O(n log n). ISO
Returns with respect to data set pt
, the number of line segments interested by a ray from , minimum over all rays. ISO
Nabil Mustafa, Saurabh Ray, and Mudassir Shabbir.
N. Mustafa, S. Ray, and M. Shabbir, Statistical Data Depth of Pointsets in the Plane,in prep..
## calculation of RS depth z = matrix(rnorm(24),nc=2) x = rsplot(z)
## calculation of RS depth z = matrix(rnorm(24),nc=2) x = rsplot(z)
Computes the Ray Shooting rings of a bivariate data set.
rsrings(pt, numofrings=c(5),clr=FALSE,...)
rsrings(pt, numofrings=c(5),clr=FALSE,...)
pt |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one multivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). Only 2-dimensional data is acceptable in this version. |
numofrings |
Total number of rings expected. |
clr |
Boolean for whether colors are used or not. |
... |
Reserved for future use. |
Finds out the an arbitrary point among the Ray Shooting median set of given point set. Current uses the brute-force algorithm on all O(n^4) possible points
in the arrangment of all possible lines in complete graph on pt
. For each point O(n log n) is used to find out depth so overall complexity of this algorithm is O(n^5 log n).
When approximation parameter is provided then algorithm tries to approximate by finding median of a uniform sample subset of pt of size 1/eps^2*log(1/eps). If this constant is more than the size of original set then eps value is ignored and exact median is calculate on original point set.
Number of rings returned
Nabil Mustafa, Saurabh Ray, and Mudassir Shabbir.
N. Mustafa, S. Ray, and M. Shabbir, Statistical Data Depth of Pointsets in the Plane,in prep..
rsdepth
for depth function
## RS median of a two-dimensional data set set.seed(617) zz <- matrix(rnorm(60), nc = 2) rsrings(zz)
## RS median of a two-dimensional data set set.seed(617) zz <- matrix(rnorm(60), nc = 2) rsrings(zz)
Computes the Ray Shooting rings of a bivariate data set.
rstinterval(pt, beta=c(0.90), sampleSize=c(250), M=c(50),clr=FALSE, ...)
rstinterval(pt, beta=c(0.90), sampleSize=c(250), M=c(50),clr=FALSE, ...)
pt |
The data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one multivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations). Only 2-dimensional data is acceptable in this version. |
beta |
beta is a parameter between 0 and 1 determines the accuracy of the interval. Set to 0.90 by default. |
sampleSize |
Size of the sample data set. |
M |
Size of test data set. |
clr |
Clear the canvas before use or not. Boolean and set to FALSE by default |
... |
Reserved for future use. |
This function creates a two dimension generalization of confidence intervals of data. A bag that contains beta fraction of data points is constructed.
Should not return anything
Nabil Mustafa, Saurabh Ray, and Mudassir Shabbir.
N. Mustafa, S. Ray, and M. Shabbir, Statistical Data Depth of Pointsets in the Plane,in prep..
rsdepth
for depth function
## RS median of a two-dimensional data set set.seed(617) zz <- matrix(rnorm(600), nc = 2) rstinterval(zz)
## RS median of a two-dimensional data set set.seed(617) zz <- matrix(rnorm(600), nc = 2) rstinterval(zz)