Skip to content

Commit ad10b5c

Browse files
committed
Final touches before submitting to CRAN.
1 parent e7ea9aa commit ad10b5c

File tree

10 files changed

+51
-18
lines changed

10 files changed

+51
-18
lines changed

DESCRIPTION

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
Package: fitHeavyTail
22
Title: Mean and Covariance Matrix Estimation under Heavy Tails
3-
Version: 0.1.2.9000
4-
Date: 2020-1-7
3+
Version: 0.1.3
4+
Date: 2022-4-14
55
Description: Robust estimation methods for the mean vector, scatter matrix,
66
and covariance matrix (if it exists) from data (possibly containing NAs)
77
under multivariate heavy-tailed distributions such as angular Gaussian
88
(via Tyler's method), Cauchy, and Student's t distributions. Additionally,
9-
a factor model structure can be specified for the covariance matrix.
9+
a factor model structure can be specified for the covariance matrix. The
10+
latest revision also includes the multivariate skewed t distribution.
1011
The package is based on the papers: Sun, Babu, and Palomar (2014),
1112
Sun, Babu, and Palomar (2015), Liu and Rubin (1995), and
1213
Zhou, Liu, Kumar, and Palomar (2019).
@@ -24,7 +25,6 @@ URL: https://CRAN.R-project.org/package=fitHeavyTail,
2425
BugReports: https://github.com/dppalomar/fitHeavyTail/issues
2526
License: GPL-3
2627
Encoding: UTF-8
27-
LazyData: true
2828
RoxygenNote: 7.1.1
2929
Depends:
3030
Imports:

NAMESPACE

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ importFrom(mvtnorm,dmvt)
1111
importFrom(numDeriv,grad)
1212
importFrom(stats,cov)
1313
importFrom(stats,median)
14+
importFrom(stats,na.omit)
1415
importFrom(stats,optimize)
16+
importFrom(stats,uniroot)
1517
importFrom(stats,var)
1618
importFrom(utils,tail)

NEWS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Changes in fitHeavyTail version 0.1.2.9000
1+
## Changes in fitHeavyTail version 0.1.3 (2022-4-14)
22

33
* New method for skewed t distributions: fit_mvst()
44

R/fit_mvt.R

+6-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#' \item{\code{psi}: default is
5858
#' \code{diag(initial$cov - initial$B \%*\% t(initial$B)).}}}
5959
#' @param optimize_mu Boolean indicating whether to optimize \code{mu} (default is \code{TRUE}).
60+
#' @param weights Optional weights for each of the observations (the length should be equal to the number of rows of X).
6061
#' @param factors Integer indicating number of factors (default is \code{ncol(X)}, so no factor model assumption).
6162
#' @param max_iter Integer indicating the maximum number of iterations for the iterative estimation
6263
#' method (default is \code{100}).
@@ -104,6 +105,9 @@
104105
#' Rui Zhou, Junyan Liu, Sandeep Kumar, and Daniel P. Palomar, "Robust factor analysis parameter estimation,"
105106
#' Lecture Notes in Computer Science (LNCS), 2019. <https://arxiv.org/abs/1909.12530>
106107
#'
108+
#' Esa Ollila, Daniel P. Palomar, and Frédéric Pascal, "Shrinking the Eigenvalues of M-estimators of Covariance Matrix,"
109+
#' IEEE Trans. on Signal Processing, vol. 69, pp. 256-269, Jan. 2021.
110+
#'
107111
#' @examples
108112
#' library(mvtnorm) # to generate heavy-tailed data
109113
#' library(fitHeavyTail)
@@ -115,7 +119,7 @@
115119
#' options(nu_min = 4.01)
116120
#' fit_mvt(X, nu = "iterative")
117121
#'
118-
#' @importFrom stats optimize
122+
#' @importFrom stats optimize na.omit uniroot
119123
#' @export
120124
fit_mvt <- function(X, na_rm = TRUE,
121125
nu = c("kurtosis", "MLE-diag", "MLE-diag-resampled", "iterative"),
@@ -330,7 +334,7 @@ fit_mvt <- function(X, na_rm = TRUE,
330334
theta <- (1 - N/T) * sum(r2i)/T/N
331335
# correction with sigma
332336
T_ <- 10000
333-
X_ <- mvtnorm::rmvt(n = T_, delta = rep(0, N), sigma = diag(N), df = nu_true) # heavy-tailed data
337+
X_ <- mvtnorm::rmvt(n = T_, delta = rep(0, N), sigma = diag(N), df = nu) # heavy-tailed data
334338
r2 <- rowSums(X_^2)
335339
u <- (N + nu)/(nu + r2)
336340
r2i <- r2/(1 - r2*u/T_)

R_buildignore/developer_commands.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ devtools::build()
3939
#devtools::revdep(pkg = "fitHeavyTail") # to check reverse dependencies
4040
#devtools::check_win_release() #to check under windows
4141
#R CMD build . # this is to generate tarball
42-
#R CMD check fitHeavyTail_0.1.2.9000.tar.gz --as-cran --run-donttest # this is before submission to CRAN
43-
#R CMD install fitHeavyTail_0.1.2.9000.tar.gz
42+
#R CMD check fitHeavyTail_0.1.3.tar.gz --as-cran --run-donttest # this is before submission to CRAN
43+
#R CMD install fitHeavyTail_0.1.3.tar.gz
4444
#submit the tarball directly via the webform: https://cran.r-project.org/submit.html

cran-comments.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
This is version 0.1.2 (2020-1-7) in CRAN (package also available in GitHub).
1+
This is version 0.1.3 (2022-4-14) in CRAN (package also available in GitHub).
22

33
---
44

55
## Test environments
6-
* OS X, R 3.6.0
6+
* OS X, R 4.1.2
77
* Windows at https://win-builder.r-project.org/
88

99
## R CMD check results

inst/CITATION

+25-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ citHeader("To cite 'fitHeavyTail' in publications, please use:")
33
citEntry(entry = "Manual",
44
title = "{fitHeavyTail: Mean and Covariance Matrix Estimation under Heavy Tails}",
55
author = personList(as.person("D. P. Palomar"),
6-
as.person("Rui ZHOU")),
7-
note = "R package version 0.1.2",
8-
year = "2020",
6+
as.person("Rui Zhou"),
7+
as.person("Xiwen Wang")),
8+
note = "R package version 0.1.3",
9+
year = "2022",
910
url = "https://CRAN.R-project.org/package=fitHeavyTail",
1011
textVersion =
11-
paste("D. P. Palomar and Rui Zhou (2020).",
12+
paste("D. P. Palomar, Rui Zhou, and Xiwen Wang (2022).",
1213
"fitHeavyTail: Mean and Covariance Matrix Estimation under Heavy Tails.",
13-
"R package version 0.1.2.",
14+
"R package version 0.1.3.",
1415
"https://CRAN.R-project.org/package=fitHeavyTail")
1516
)
1617

@@ -51,3 +52,22 @@ citEntry(entry = "Article",
5152
"vol. 63, no. 12, pp. 3096-3109.",
5253
"https://doi.org/10.1109/TSP.2015.2417513")
5354
)
55+
56+
citEntry(entry = "Article",
57+
title = "Shrinking the Eigenvalues of M-estimators of Covariance Matrix",
58+
author = personList(as.person("E. Ollila"),
59+
as.person("D. P. Palomar"),
60+
as.person("F. Pascal")),
61+
journal = "IEEE Transactions on Signal Processing",
62+
volume = "69",
63+
pages = "256--269",
64+
year = "2021",
65+
url = "https://doi.org/10.1109/TSP.2020.3043952",
66+
textVersion =
67+
paste("E. Ollila, D. P. Palomar, and F. Pascal (2021).",
68+
"Shrinking the Eigenvalues of M-estimators of Covariance Matrix.",
69+
"IEEE Transactions on Signal Processing,",
70+
"vol. 69, pp. 256-269.",
71+
"https://doi.org/10.1109/TSP.2020.3043952")
72+
)
73+

man/fit_mvt.Rd

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-fit_mvst.R

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ test_that("default mode works", {
3939
load("fitted_mvst_check.RData")
4040

4141
mvst_model <- fit_mvst(X, ptol = 1e-4)
42+
4243
expect_equal(mvst_model[c("mu", "gamma", "scatter", "nu", "mean", "cov", "converged", "num_iterations")],
43-
mvst_model_check[c("mu", "gamma", "scatter", "nu", "mean", "cov", "converged", "num_iterations")]) #, tolerance = 0.1)
44+
mvst_model_check[c("mu", "gamma", "scatter", "nu", "mean", "cov", "converged", "num_iterations")],
45+
tolerance = 1e-5)
4446

4547
# test for xts
4648
mvst_model <- fit_mvst(X)

tests/testthat/test-fit_mvt.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test_that("error control works", {
2222
"Cannot deal with T <= N (after removing NAs), too few samples.", fixed = TRUE)
2323
expect_error(fit_mvt(X = X, max_iter = -1), "\"max_iter\" must be greater than 1.")
2424
expect_error(fit_mvt(X = X, factors = -1), "\"factors\" must be no less than 1 and no more than column number of \"X\".")
25-
expect_error(fit_mvt(X = X, nu = "lala"), "'arg' should be one of kurtosis”, “MLE-diag”, “MLE-diag-resampled”, “iterative")
25+
expect_error(fit_mvt(X = X, nu = "lala"), "'arg' should be one of \"kurtosis\", \"MLE-diag\", \"MLE-diag-resampled\", \"iterative\"")
2626
expect_error(fit_mvt(X = X, nu = 1), "Non-valid value for nu.")
2727
})
2828

0 commit comments

Comments
 (0)