Skip to content

Commit

Permalink
cran maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
earowang committed Jul 30, 2024
1 parent 3f444cf commit df1845f
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 26 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
^CRAN-RELEASE$
^codecov\.yml$
^\.github$
^CRAN-SUBMISSION$
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 6.0.3
Date: 2024-07-30 11:20:38 UTC
SHA: 3f444cf6d6aca23a3a7f2d482df2e33bb078dc55
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hts
Title: Hierarchical and Grouped Time Series
Version: 6.0.2
Version: 6.0.3
Authors@R: c(
person("Rob", "Hyndman", role = "aut", comment = "Package creator"),
person("Alan", "Lee", role = "aut", comment = "Fast computation using recursive methods"),
Expand Down Expand Up @@ -39,6 +39,6 @@ URL: https://pkg.earo.me/hts/
BugReports: https://github.com/earowang/hts/issues
License: GPL (>= 2)
VignetteBuilder: knitr
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE, roclets=c('rd', 'collate', 'namespace'))
Encoding: UTF-8
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export(smatrix)
export(summary.gts)
export(summary.hts)
import(Matrix)
import(SparseM)
import(forecast)
import(grDevices)
import(methods)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# hts 6.0.3

* Cran maintenance

# hts 6.0.2

* Removed dependency on matrixcalc
Expand Down
2 changes: 1 addition & 1 deletion R/MinT.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ shrink.estim <- function(x, tar)
#' \code{\link[hts]{forecast.gts}}, \code{\link[hts]{combinef}}
#' @references Wickramasuriya, S. L., Athanasopoulos, G., & Hyndman, R. J. (2019).
#' Optimal forecast reconciliation for hierarchical and grouped time series through trace minimization.
#' \emph{Journal of the American Statistical Association}, \bold{114}(526), 804--819. \url{https://robjhyndman.com/working-papers/mint/}
#' \emph{Journal of the American Statistical Association}, \bold{114}(526), 804--819. \url{https://robjhyndman.com/publications/mint/}
#'
#' Wickramasuriya, S. L., Turlach, B. A., & Hyndman, R. J. (to appear). Optimal non-negative forecast reconciliation.
#' \emph{Statistics and Computing}. \url{https://robjhyndman.com/publications/nnmint/}
Expand Down
2 changes: 1 addition & 1 deletion R/gts.R
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ CreateGmat <- function(bnames, characters) {
gmatrix <- gmatrix[!duplicated(gmatrix), , drop = FALSE]
# Remove bottom names if it has
check <- try(which(gmatrix == bnames, arr.ind = TRUE)[1L, 1L], silent = TRUE)
if (class(check) != "try-error") {
if (class(check) != "try-error") {
gmatrix <- gmatrix[-check, ]
}
return(gmatrix)
Expand Down
4 changes: 2 additions & 2 deletions R/imports.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#' @importFrom utils combn
#' @import methods
#' @importFrom stats window as.ts fitted frequency is.ts na.omit residuals time ts tsp tsp<-
#' @import Matrix
#' @import SparseM
#' @import Matrix
#' @importFrom(SparseM,as.matrix.csr)
#' @import forecast
#' @import parallel
#' @useDynLib hts
Expand Down
22 changes: 11 additions & 11 deletions R/tracemin.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ LU <- function(fcasts, S, weights, allow.changes = FALSE) {
nbts <- ncol(S)
nagg <- nts - nbts
seqagg <- 1L:nagg

if (!allow.changes) {
utmat <- cbind2(sparseMatrix(i = seqagg, j = seqagg, x = 1),
-1 * S[1L:nagg, ])
-1 * S[1L:nagg, , drop = TRUE])
} else {
# Identifying rows with one 1 element to make the Identity matrix in S
indx <- rowSums(S)
idx <- tail(which(indx == 1L), nbts)
idx <- tail(which(indx == 1L), nbts)

# Permulation vector to rearrange rows of S, rows/col of W and forecasts
pvec <- c(setdiff(1:nts, idx) , idx)
S2 <- S[pvec, ]
weights <- weights[pvec, pvec]
fcasts <- fcasts[pvec, ]
utmat <- cbind2(sparseMatrix(i = seqagg, j = seqagg, x = 1),
-1 * S2[1L:nagg, ])
utmat <- cbind2(sparseMatrix(i = seqagg, j = seqagg, x = 1),
-1 * S2[1L:nagg, , drop = TRUE])
}
jmat <- sparseMatrix(i = 1L:nbts, j = (nagg + 1L):nts, x = rep(1L, nbts),
dims = c(nbts, nts))
Expand Down Expand Up @@ -74,14 +74,14 @@ CG <- function(fcasts, S, weights, allow.changes = FALSE) {
} else {
# Identifying rows with one 1 element to make the Identity matrix in S
indx <- rowSums(S)
idx <- tail(which(indx == 1L), nbts)
idx <- tail(which(indx == 1L), nbts)

# Permulation vector to rearrange rows of S, rows/col of W and forecasts
pvec <- c(setdiff(1:nts, idx) , idx)
S2 <- S[pvec, ]
weights <- weights[pvec, pvec]
fcasts <- fcasts[pvec, ]
utmat <- cbind2(Matrix::sparseMatrix(i = seqagg, j = seqagg, x = 1),
utmat <- cbind2(Matrix::sparseMatrix(i = seqagg, j = seqagg, x = 1),
-1 * S2[1L:nagg, ])

This comment has been minimized.

Copy link
@felixfesca

felixfesca Jul 30, 2024

The additional drop = FALSE is also missing here (and in line 73, 116 and 128)!

}
jmat <- Matrix::sparseMatrix(i = 1L:nbts, j = (nagg + 1L):nts, x = rep(1L, nbts),
Expand Down Expand Up @@ -118,8 +118,8 @@ CHOL <- function(fcasts, S, weights, allow.changes = FALSE) {
# Identifying rows with one 1 element to make the Identity matrix in S
Sm <- as(S, "dgCMatrix")
indx <- rowSums(Sm)
idx <- tail(which(indx == 1L), nbts)
idx <- tail(which(indx == 1L), nbts)

# Permulation vector to rearrange rows of S, rows/col of W and forecasts
pvec <- c(setdiff(1:nts, idx) , idx)
S2 <- S[pvec, ]
Expand Down
7 changes: 1 addition & 6 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
## Comments

This is a resubmission that urls have been fixed.

## Test environments
* local R installation Ubuntu 21.04, R 4.1.0
* macOS release, windows release, windows 3.6, ubuntu 16.04 devel, ubuntu 16.04 release, ubuntu 16.04 oldrel, ubuntu 16.04 3.5 on github actions
* win-builder (devel)
This is a submission to fix CRAN errors.

## R CMD check results

Expand Down
2 changes: 1 addition & 1 deletion man/MinT.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plot.gts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// cgm_c
Eigen::MatrixXd cgm_c(SEXP As, SEXP bs);
RcppExport SEXP _hts_cgm_c(SEXP AsSEXP, SEXP bsSEXP) {
Expand Down
1 change: 1 addition & 0 deletions vignettes/hts.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit df1845f

Please sign in to comment.