Skip to content

Commit 227d875

Browse files
committed
Last revisions on v.0.1.1
1 parent 5e373e8 commit 227d875

10 files changed

+81
-77
lines changed

.Rbuildignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
^.*\.Rproj$
22
^\.Rproj\.user$
33
^cran-comments\.md$
4+
^LICENSE$
45
^README\.Rmd$
56
^README\.html$
67
^README_cache$

DESCRIPTION

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
11
Package: fitHeavyTail
22
Title: Mean and Covariance Matrix Estimation under Heavy Tails
33
Version: 0.1.1
4-
Date: 2019-11-16
4+
Date: 2019-11-22
55
Description: Robust estimation methods for the mean vector and covariance matrix
66
from data (possibly containing NAs) under multivariate heavy-tailed
77
distributions such as angular Gaussian, Cauchy, and Student's t. Additionally,
88
a factor model structure can be specified for the covariance matrix.
9+
The package is based on the papers:
10+
Y. Sun, P. Babu, and D. P. Palomar (2014). Regularized Tyler’s Scatter
11+
Estimator: Existence, Uniqueness, and Algorithms. IEEE Trans. on Signal
12+
Processing, vol. 62, no. 19, pp. 5143-5156. <doi:10.1109/TSP.2014.2348944>.
13+
Y. Sun, P. Babu, and D. P. Palomar (2015). Regularized Robust Estimation of
14+
Mean and Covariance Matrix Under Heavy-Tailed Distributions. IEEE Trans. on
15+
Signal Processing, vol. 63, no. 12, pp. 3096-3109. <doi:10.1109/SAM.2014.6882356>.
16+
Chuanhai Liu and Donald B. Rubin (1995).
17+
ML estimation of the t-distribution using EM and its extensions, ECM and ECME.
18+
Statistica Sinica (5), pp. 19-39.
19+
<https:www3.stat.sinica.edu.tw/statistica/oldpdf/A5n12.pdf>.
20+
R. Zhou, J. Liu, S. Kumar, and D. P. Palomar (2015).
21+
Robust factor analysis parameter estimation.
22+
Lecture Notes in Computer Science (LNCS). <arXiv:1909.12530>.
923
Authors@R: c(
1024
person(c("Daniel", "P."), "Palomar", role = c("cre", "aut"), email = "[email protected]"),
1125
person("Rui", "Zhou", role = "aut", email = "[email protected]")
1226
)
1327
Maintainer: Daniel P. Palomar <[email protected]>
1428
URL: https://github.com/dppalomar/fitHeavyTail
1529
BugReports: https://github.com/dppalomar/fitHeavyTail/issues
16-
License: GPL-3 | file LICENSE
30+
License: GPL-3
1731
Encoding: UTF-8
1832
LazyData: true
1933
RoxygenNote: 6.1.1

NEWS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Changes in fitHeavyTail version 0.1.1 (2019-11-16)
1+
## Changes in fitHeavyTail version 0.1.1 (2019-11-22)
22

33
* Initial release is on CRAN.
44

README.Rmd

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
always_allow_html: yes
33
output:
4-
md_document:
5-
variant: markdown_github
64
html_document:
75
keep_md: yes
86
variant: markdown_github
7+
md_document:
8+
variant: markdown_github
99
---
1010

1111
<!-- README.md is generated from README.Rmd. Please edit that file -->
@@ -27,11 +27,9 @@ knit_hooks$set(pngquant = hook_pngquant)
2727

2828

2929
# fitHeavyTail
30-
<!---
3130
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/fitHeavyTail)](https://CRAN.R-project.org/package=fitHeavyTail)
3231
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/fitHeavyTail)](https://CRAN.R-project.org/package=fitHeavyTail)
3332
[![CRAN Downloads Total](https://cranlogs.r-pkg.org/badges/grand-total/fitHeavyTail?color=brightgreen)](https://CRAN.R-project.org/package=fitHeavyTail)
34-
--->
3533

3634
Robust estimation methods for the mean vector and covariance matrix
3735
from data (possibly containing NAs) under multivariate heavy-tailed
@@ -121,17 +119,17 @@ ggplot(data.frame(x = X[, i1], y = X[, i2]), aes(x, y)) +
121119
```
122120

123121

124-
<!---
122+
125123
## Documentation
126124
For more detailed information, please check the
127125
[vignette](https://CRAN.R-project.org/package=fitHeavyTail/vignettes/CovarianceEstimationHeavyTail.html).
128-
--->
126+
129127

130128

131129
## Links
132130
Package: [CRAN](https://CRAN.R-project.org/package=fitHeavyTail) and [GitHub](https://github.com/dppalomar/fitHeavyTail).
133131

134132
README file: [GitHub-readme](https://github.com/dppalomar/fitHeavyTail/blob/master/README.md).
135-
<!---
133+
136134
Vignette: [CRAN-vignette](https://CRAN.R-project.org/package=fitHeavyTail/vignettes/CovarianceEstimationHeavyTail.html).
137-
--->
135+

README.html

+7-13
Large diffs are not rendered by default.

README.md

+40-44
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1+
---
2+
always_allow_html: yes
3+
output:
4+
html_document:
5+
keep_md: yes
6+
variant: markdown_github
7+
md_document:
8+
variant: markdown_github
9+
---
10+
111
<!-- README.md is generated from README.Rmd. Please edit that file -->
212

3-
fitHeavyTail
4-
============
513

6-
<!---
14+
15+
16+
17+
# fitHeavyTail
718
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/fitHeavyTail)](https://CRAN.R-project.org/package=fitHeavyTail)
819
[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/fitHeavyTail)](https://CRAN.R-project.org/package=fitHeavyTail)
920
[![CRAN Downloads Total](https://cranlogs.r-pkg.org/badges/grand-total/fitHeavyTail?color=brightgreen)](https://CRAN.R-project.org/package=fitHeavyTail)
10-
--->
11-
12-
Robust estimation methods for the mean vector and covariance matrix from
13-
data (possibly containing NAs) under multivariate heavy-tailed
14-
distributions such as angular Gaussian, Cauchy, and Student’s *t*.
15-
Additionally, a factor model structure can be specified for the
16-
covariance matrix.
1721

18-
Installation
19-
------------
22+
Robust estimation methods for the mean vector and covariance matrix
23+
from data (possibly containing NAs) under multivariate heavy-tailed
24+
distributions such as angular Gaussian, Cauchy, and Student's $t$. Additionally,
25+
a factor model structure can be specified for the covariance matrix.
26+
2027

21-
The package can be installed from
22-
[CRAN](https://CRAN.R-project.org/package=fitHeavyTail) or
23-
[GitHub](https://github.com/dppalomar/fitHeavyTail):
28+
## Installation
29+
The package can be installed from [CRAN](https://CRAN.R-project.org/package=fitHeavyTail) or [GitHub](https://github.com/dppalomar/fitHeavyTail):
2430

25-
``` r
31+
```r
2632
# install stable version from CRAN
2733
install.packages("fitHeavyTail")
2834

@@ -32,26 +38,23 @@ devtools::install_github("dppalomar/fitHeavyTail")
3238

3339
To get help:
3440

35-
``` r
41+
```r
3642
library(fitHeavyTail)
3743
help(package = "fitHeavyTail")
3844
?fit_mvt
3945
```
4046

4147
To cite `fitHeavyTail` in publications:
4248

43-
``` r
49+
```r
4450
citation("fitHeavyTail")
4551
```
4652

47-
Quick Start
48-
-----------
4953

50-
To illustrate the simple usage of the package `fitHeavyTail`, let’s
51-
start by generating some multivariate data under a Student’s *t*
52-
distribution with significant heavy tails (*ν* = 4):
54+
## Quick Start
55+
To illustrate the simple usage of the package `fitHeavyTail`, let's start by generating some multivariate data under a Student's $t$ distribution with significant heavy tails ($\nu=4$):
5356

54-
``` r
57+
```r
5558
library(mvtnorm) # package for multivariate t distribution
5659
N <- 10 # number of variables
5760
T <- 80 # number of observations
@@ -65,25 +68,23 @@ Sigma_scatter <- (nu-2)/nu * Sigma
6568
X <- rmvt(n = T, delta = mu, sigma = Sigma_scatter, df = nu) # generate data
6669
```
6770

68-
We can first estimate the mean vector and covariance matrix via the
69-
traditional sample estimates (i.e., sample mean and sample covariance
70-
matrix):
71+
We can first estimate the mean vector and covariance matrix via the traditional sample estimates (i.e., sample mean and sample covariance matrix):
7172

72-
``` r
73+
```r
7374
mu_sm <- colMeans(X)
7475
Sigma_scm <- cov(X)
7576
```
7677

7778
Then we can compute the robust estimates via the package `fitHeavyTail`:
7879

79-
``` r
80+
```r
8081
library(fitHeavyTail)
8182
fitted <- fit_mvt(X)
8283
```
8384

8485
We can now compute the estimation errors and see the big improvement:
8586

86-
``` r
87+
```r
8788
sum((mu_sm - mu)^2)
8889
#> [1] 0.2857323
8990
sum((fitted$mu - mu)^2)
@@ -95,26 +96,21 @@ sum((fitted$cov - Sigma)^2)
9596
#> [1] 2.957443
9697
```
9798

98-
To get a visual idea of the robustness, we can plot the shapes of the
99-
covariance matrices (true and estimated ones) projected on two
100-
dimensions. Observe how the heavy-tailed estimation follows the true one
101-
more closely than the sample covariance matrix:
99+
To get a visual idea of the robustness, we can plot the shapes of the covariance matrices (true and estimated ones) projected on two dimensions. Observe how the heavy-tailed estimation follows the true one more closely than the sample covariance matrix:
102100
<img src="man/figures/README-ellipses-1.png" width="80%" style="display: block; margin: auto;" />
103101

104-
<!---
102+
103+
105104
## Documentation
106105
For more detailed information, please check the
107106
[vignette](https://CRAN.R-project.org/package=fitHeavyTail/vignettes/CovarianceEstimationHeavyTail.html).
108-
--->
109107

110-
Links
111-
-----
112108

113-
Package: [CRAN](https://CRAN.R-project.org/package=fitHeavyTail) and
114-
[GitHub](https://github.com/dppalomar/fitHeavyTail).
115109

116-
README file:
117-
[GitHub-readme](https://github.com/dppalomar/fitHeavyTail/blob/master/README.md).
118-
<!---
110+
## Links
111+
Package: [CRAN](https://CRAN.R-project.org/package=fitHeavyTail) and [GitHub](https://github.com/dppalomar/fitHeavyTail).
112+
113+
README file: [GitHub-readme](https://github.com/dppalomar/fitHeavyTail/blob/master/README.md).
114+
119115
Vignette: [CRAN-vignette](https://CRAN.R-project.org/package=fitHeavyTail/vignettes/CovarianceEstimationHeavyTail.html).
120-
--->
116+

cran-comments.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
First release in CRAN, version 0.1.1 (2019-11-16), (package also available in GitHub).
1+
First release in CRAN, version 0.1.1 (2019-11-22), (package also available in GitHub).
22

33
---
44

tests/testthat/test-fit_mvt.R

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ test_that("factor structure constraint on scatter matrix works", {
5757
# save(mvt_model_factor_check, file = "fitted_mvt_factor_check.RData", version = 2, compress = "xz")
5858
mvt_model_factor <- fit_mvt(X, factors = 3)
5959
load("fitted_mvt_factor_check.RData")
60-
expect_equal(mvt_model_factor, mvt_model_factor_check)
60+
expect_equal(mvt_model_factor[c("mu", "cov", "scatter", "nu", "psi", "converged")],
61+
mvt_model_factor_check[c("mu", "cov", "scatter", "nu", "psi", "converged")])
62+
expect_equal(mvt_model_factor$B %*% t(mvt_model_factor$B),
63+
mvt_model_factor_check$B %*% t(mvt_model_factor_check$B))
6164
})
6265

6366

vignettes/CovarianceEstimationHeavyTail.Rmd

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ knit_hooks$set(pngquant = hook_pngquant)
4141
```
4242

4343
-----------
44-
> This vignette illustrates the usage of the package [`portfolioBacktest`](https://CRAN.R-project.org/package=fitHeavyTail)
44+
> This vignette illustrates the usage of the package [`fitHeavyTail`](https://CRAN.R-project.org/package=fitHeavyTail)
4545
to estimate the mean vector and covariance matrix of heavy-tailed multivariate distributions such as the angular Gaussian, Cauchy, or Student's $t$ distribution. The results are compared against existing benchmark functions from different packages.
4646

4747

@@ -87,7 +87,6 @@ Sigma_scm <- cov(X)
8787
Then we can compute the robust estimates via the package `fitHeavyTail`:
8888
```{r}
8989
library(fitHeavyTail)
90-
9190
fitted <- fit_mvt(X)
9291
```
9392

vignettes/CovarianceEstimationHeavyTail.html

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<meta name="viewport" content="width=device-width, initial-scale=1">
1212

1313

14-
<meta name="date" content="2019-11-15" />
14+
<meta name="date" content="2019-11-22" />
1515

1616
<title>Mean Vector and Covariance Matrix Estimation under Heavy Tails</title>
1717

@@ -113,7 +113,7 @@
113113
<h1 class="title toc-ignore">Mean Vector and Covariance Matrix Estimation under Heavy Tails</h1>
114114
<h3 class="author"><div class="line-block">Daniel P. Palomar and Rui ZHOU<br />
115115
The Hong Kong University of Science and Technology (HKUST)</div></h3>
116-
<h3 class="date">2019-11-15</h3>
116+
<h3 class="date">2019-11-22</h3>
117117
</header>
118118

119119
<hr>
@@ -131,7 +131,7 @@ <h3 class="date">2019-11-15</h3>
131131

132132
<hr />
133133
<blockquote>
134-
<p>This vignette illustrates the usage of the package <a href="https://CRAN.R-project.org/package=fitHeavyTail"><code>portfolioBacktest</code></a> to estimate the mean vector and covariance matrix of heavy-tailed multivariate distributions such as the angular Gaussian, Cauchy, or Student’s <span class="math inline">\(t\)</span> distribution. The results are compared against existing benchmark functions from different packages.</p>
134+
<p>This vignette illustrates the usage of the package <a href="https://CRAN.R-project.org/package=fitHeavyTail"><code>fitHeavyTail</code></a> to estimate the mean vector and covariance matrix of heavy-tailed multivariate distributions such as the angular Gaussian, Cauchy, or Student’s <span class="math inline">\(t\)</span> distribution. The results are compared against existing benchmark functions from different packages.</p>
135135
</blockquote>
136136
<div id="installation" class="section level1">
137137
<h1>Installation</h1>
@@ -166,8 +166,7 @@ <h1>Quick Start</h1>
166166
<a class="sourceLine" id="cb3-2" title="2">Sigma_scm &lt;-<span class="st"> </span><span class="kw">cov</span>(X)</a></code></pre></div>
167167
<p>Then we can compute the robust estimates via the package <code>fitHeavyTail</code>:</p>
168168
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1"><span class="kw">library</span>(fitHeavyTail)</a>
169-
<a class="sourceLine" id="cb4-2" title="2"></a>
170-
<a class="sourceLine" id="cb4-3" title="3">fitted &lt;-<span class="st"> </span><span class="kw">fit_mvt</span>(X)</a></code></pre></div>
169+
<a class="sourceLine" id="cb4-2" title="2">fitted &lt;-<span class="st"> </span><span class="kw">fit_mvt</span>(X)</a></code></pre></div>
171170
<p>We can now compute the estimation errors and see the big improvement:</p>
172171
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" title="1"><span class="kw">sum</span>((mu_sm <span class="op">-</span><span class="st"> </span>mu)<span class="op">^</span><span class="dv">2</span>)</a>
173172
<a class="sourceLine" id="cb5-2" title="2"><span class="co">#&gt; [1] 0.2857323</span></a>

0 commit comments

Comments
 (0)