-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
132 lines (94 loc) · 3.69 KB
/
README.Rmd
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
output: github_document
---
DepthProc
========================================================
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, echo=FALSE}
set.seed(123)
knitr::opts_chunk$set(
echo = TRUE,
results="hide",
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
*DepthProc* project consist of a set of statistical procedures based on so called statistical depth functions. The project involves free available R package and its description.
### Versions
#### CRAN release version
[![GitHub stars](https://img.shields.io/github/stars/zzawadz/DepthProc.svg?style=social&label=Stars)](https://github.com/zzawadz/DepthProc/stargazers)
[![GitHub watchers](https://img.shields.io/github/watchers/zzawadz/DepthProc.svg?style=social&label=Watch)](https://github.com/zzawadz/DepthProc)
[![CRAN version](https://www.r-pkg.org/badges/version/DepthProc)](https://CRAN.R-project.org/package=DepthProc)
[![Downloads](https://cranlogs.r-pkg.org/badges/DepthProc)](https://CRAN.R-project.org/package=DepthProc)
[![](https://cranlogs.r-pkg.org/badges/grand-total/DepthProc)](https://CRAN.R-project.org/package=DepthProc)
[![Build Status](https://travis-ci.org/zzawadz/DepthProc.svg?branch=master)](https://travis-ci.org/zzawadz/DepthProc)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/zzawadz/DepthProc?branch=master&svg=true)](https://ci.appveyor.com/project/zzawadz/DepthProc)
[![Coverage Status](https://img.shields.io/codecov/c/github/zzawadz/DepthProc/master.svg)](https://codecov.io/github/zzawadz/DepthProc?branch=master)
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
## Installation
*DepthProc* is avaiable on CRAN:
```{r, eval=FALSE}
install.packages("DepthProc")
```
You can also install it from GitHub with *devtools* package:
```{r, eval=FALSE}
library(devtools)
install_github("zzawadz/DepthProc")
```
## Main features:
### Speed and multithreading
Most of the code is written in C++ for additional efficiency. We also use OpenMP to speedup computations with multithreading:
```{r, message=FALSE, warning=FALSE, echo=TRUE, results='markup'}
library(DepthProc)
set.seed(123)
d <- 10
x <- mvrnorm(1000, rep(0, d), diag(d))
# Default - utilize as many threads as possible
system.time(depth(x, x, method = "LP"))
# Only single thread - 4 times slower:
system.time(depth(x, x, method = "LP", threads = 1))
# Two threads - 2 times slower:
system.time(depth(x, x, method = "LP", threads = 2))
```
## Available depth functions
```{r}
x <- mvrnorm(100, c(0, 0), diag(2))
depthEuclid(x, x)
depthMah(x, x)
depthLP(x, x)
depthProjection(x, x)
depthLocal(x, x)
depthTukey(x, x)
## Base function to call others:
depth(x, x, method = "Projection")
depth(x, x, method = "Local", depth_params1 = list(method = "LP"))
## Get median
depthMedian(x,
depth_params = list(
method = "Local",
depth_params1 = list(method = "LP")))
```
## Basic plots
### Contour plot
```{r contour}
library(mvtnorm)
y <- rmvt(n = 200, sigma = diag(2), df = 4, delta = c(3, 5))
depthContour(y, points = TRUE, graph_params = list(lwd = 2))
```
### Perspective plot
```{r persp}
depthPersp(y, depth_params = list(method = "Mahalanobis"))
```
## Functional depths:
There are two functional depths implemented - modified band depth (MBD), and Frainman-Muniz depth (FM):
```{r}
x <- matrix(rnorm(60), nc = 20)
fncDepth(x, method = "MBD")
fncDepth(x, method = "FM", dep1d = "Mahalanobis")
```
### Functional BoxPlot
```{r fncBox}
x <- matrix(rnorm(2000), ncol = 100)
fncBoxPlot(x, bands = c(0, 0.5, 1), method = "FM")
```