Skip to content

Commit

Permalink
Merge pull request #186 from atsa-es/v3-11-7
Browse files Browse the repository at this point in the history
done with next CRAN release (hopefully)
  • Loading branch information
eeholmes authored May 20, 2023
2 parents 3053fe6 + 6dfd943 commit 65d5d1f
Show file tree
Hide file tree
Showing 63 changed files with 23,805 additions and 42 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: MARSS
Type: Package
Title: Multivariate Autoregressive State-Space Modeling
Version: 3.11.7
Version: 3.11.8
Date: 2023-05-20
Depends: R (>= 3.5.0)
Imports:
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ importFrom(generics,tidy)

## register S3 methods
export(MARSSfit) # method
S3method(MARSSfit, default)
S3method(MARSSfit, kem)
S3method(MARSSfit, BFGS)

Expand Down
10 changes: 9 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
output: html_document
---

# MARSS 3.11.7 (GitHub)
# MARSS 3.11.8 (CRAN 2023-05-20)

This combines the changes in GitHub releases 3.11.7 and 3.11.6.

# MARSS 3.11.7 (GitHub 2023-05-19)

This release is focused on moving the MARSS User Guide and derivation files into a `inst/userguide` and `inst/derivations` along with Makefiles to build. This will facilitate updating MARSS and converting the User Guide to an eBook.

Expand All @@ -26,6 +30,10 @@ This release is focused on moving the MARSS User Guide and derivation files into
* Added `inst/DEVELOPER_NOTES.md`
* Minor change to make the v and w in `EMDerivation.Rnw` in slant font as they are random variables.

## OTHER

* renamed `all.equal.vector` to `vector.all.equal()` so it is not interpreted as a method of `all.equal()`.


# MARSS 3.11.6 (GitHub)

Expand Down
8 changes: 6 additions & 2 deletions R/MARSS-methods.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#' Generic for fitting MARSS models
#'
#' Uses the method of a marssMLE class object. Will call a function such as [MARSSkem()], [MARSSoptim()] or `MARSStmb()` in the {marssTMB} package.
#' This is an internal function used by [MARSS()]. It is not
#' intended for use by users but needs to be exported so
#' {marssTMB} can use it. Uses the method of a marssMLE class object.
#' Will call a function such as [MARSSkem()], [MARSSoptim()] in the
#' MARSS package or `MARSStmb()` in the {marssTMB} package.
#' @param x a [marssMLE] object.
#' @param ... additional arguments for the fitting function
MARSSfit <- function(x, ...) {
UseMethod("MARSSfit")
}

MARSSfit.default <- function(x, ...){
stop("MARSS: Something is wrong. Did not find a method for the marssMLE object. Is method set incorrectly?\n There must be a MARSSfit.<method>() function for each method.")
stop("MARSS: Something is wrong. Did not find a method for the marssMLE object. The first element of the call of the object should be the method. Did you call MARSSfit() with a marssMLE object? You need to add the method as the first element of the class.")
}

MARSSfit.kem <- function(x, ...) MARSSkem(x)
Expand Down
8 changes: 4 additions & 4 deletions R/toLatex_marssMODEL.R
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ build.eqn.tex <- function(eqn, eqn.special, x, greek, digits, simplify, headfoot
# The following tests for that
mat2D <- array(mat, dim = c(dim(mat)[1] * dim(mat)[2], dim(mat)[3])) # reform to be 2D
# test equality within row; will return TRUE if dim 3 = 1
if (all(apply(mat, 1, all.equal.vector))) { # not time-varying
if (all(apply(mat, 1, vector.all.equal))) { # not time-varying
mat <- sub3D(mat, t = 1) # not time-varying so just use the mat at t=1
} else { # is time-varying
if (!simplify) { # then there will be an equation for each parameter at time t
Expand All @@ -378,7 +378,7 @@ build.eqn.tex <- function(eqn, eqn.special, x, greek, digits, simplify, headfoot
} else { # do simplify
# step 1: figure out which parameter elements are time-varying
mat2D <- array(mat, dim = c(dim(mat)[1] * dim(mat)[2], dim(mat)[3])) # reform to be 2D, matrix(vec(mat),t)
tv.elem <- !apply(mat2D, 1, all.equal.vector) # which elements are time varying
tv.elem <- !apply(mat2D, 1, vector.all.equal) # which elements are time varying
# step 2: replace that element with the name el2(i)_t
tv.name <- paste(el2, "(", 1:dim(mat2D)[1], ")_", el2.time, sep = "")
# step 3: set up a mat to be t=1; will replace time=varying ones
Expand Down Expand Up @@ -443,9 +443,9 @@ parameters.time.varying <- function(eqn, eqn.special, x) {
if (model.dims[[el2]][3] == 1) next # it is not time-varying
# Even if 3D, it might not be time-varying if all elements are the same
testtv <- FALSE
if (!all(apply(fixed[[el2]], 1, all.equal.vector))) testtv <- TRUE # time-varying
if (!all(apply(fixed[[el2]], 1, vector.all.equal))) testtv <- TRUE # time-varying
mat2D <- array(free[[el2]], dim = c(dim(free[[el2]])[1] * dim(free[[el2]])[2], dim(free[[el2]])[3]))
if (!all(apply(mat2D, 1, all.equal.vector))) testtv <- TRUE # time-varying
if (!all(apply(mat2D, 1, vector.all.equal))) testtv <- TRUE # time-varying
if (!testtv) { # not time-varying
next
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/utility_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ is.solvable <- function(A, y = NULL) {
return("unique")
}

all.equal.vector <- function(x) {
vector.all.equal <- function(x) {
all(sapply(as.list(x[-1]), FUN = function(z) {
identical(z, unlist(x[1]))
}))
Expand Down
27 changes: 10 additions & 17 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Tested on OS

* `rhub::check_for_cran()`
* M1 MacBook
* R versions 4.3 and 4.2

## R CMD check results

0 errors | 0 warnings | 3 notes
Expand All @@ -7,22 +13,13 @@
sub-directories of 1Mb or more:
doc 4.6Mb

* checking DESCRIPTION meta-information ... NOTE
Maintainer field differs from that derived from Authors@R
Maintainer: ‘Elizabeth Holmes - NOAA Federal <[email protected]>’
Authors@R: ‘Elizabeth Eli Holmes <[email protected]>’

For auto-check of the email that submission comes from, I use the form that my work email uses.

* checking CRAN incoming feasibility ... NOTE
Maintainer: ‘Elizabeth Holmes - NOAA Federal <[email protected]>’

* Suggests or Enhances not in mainstream repositories:
marssTMB
Availability using Additional_repositories specification:
marssTMB yes https://atsa-es.r-universe.dev

This is correct.
This is correct.

─ checking CRAN incoming feasibility ... [20s] NOTE
Maintainer: 'Elizabeth Eli Holmes <[email protected]>'
Expand All @@ -32,13 +29,9 @@ For auto-check of the email that submission comes from, I use the form that my w
Old maintainer(s):
Elizabeth Holmes - NOAA Federal <[email protected]>

Correct.

Possibly misspelled words in DESCRIPTION:
TMB (23:89)
marssTMB (24:16)

Correct. I changed to using Authors@R format


## revdepcheck results

We checked 2 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
Expand Down
6 changes: 2 additions & 4 deletions inst/DEVELOPER_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ These are the tests in `tests/testthat`. All should pass but some give warnings.
cd inst
make
```
However I usually run it one target at a time.


Now using the final tar.gz file do the final tests.

Expand All @@ -165,10 +167,6 @@ rm -r ~/Dropbox/MARSS.Rcheck
R CMD check --timings --as-cran MARSS_3.11.7.tar.gz
```


However I usually run it one target at a time.


## Check on other OS

* [ ] `devtools::check_win_devel()`
Expand Down
6 changes: 4 additions & 2 deletions inst/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RM = rm -f
version = 3.11.7
version = 3.11.8
GitHubdir = ~/Documents/GitHub
tmpdir = ~/Dropbox

Expand All @@ -24,12 +24,14 @@ build:
rm -r -f ${tmpdir}/MARSS
rm -f ${tmpdir}/MARSS_${version}.tar.gz
cp -p $(GitHubdir)/MARSS_${version}.tar.gz ${tmpdir}/MARSS_${version}.tar.gz
cd $(tmpdir) && tar -xvzf ${tmpdir}/MARSS_${version}.tar.gz

movetodoc:
cd $(tmpdir) && tar -xvzf ${tmpdir}/MARSS_${version}.tar.gz
rm -f ${tmpdir}/MARSS/inst/doc/*.pdf
cp -a -p ${GitHubdir}/MARSS/inst/derivations/doc/*.pdf ${tmpdir}/MARSS/inst/doc
cp -a -p ${GitHubdir}/MARSS/inst/userguide/doc/. $(tmpdir)/MARSS/inst/doc/
cp -a -p ${GitHubdir}/MARSS/inst/derivations/doc/. ${GitHubdir}/MARSS/inst/doc/
cp -a -p ${GitHubdir}/MARSS/inst/userguide/doc/. $(GitHubdir)/MARSS/inst/doc/

rebuild:
cd $(tmpdir) && R CMD build --no-build-vignettes MARSS
2 changes: 2 additions & 0 deletions inst/derivations/Residuals-concordance.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
\Sconcordance{concordance:Residuals.tex:Residuals.Rnw:%
1 175 1 1 0 628 1}
38 changes: 38 additions & 0 deletions inst/derivations/Residuals.bbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
\begin{thebibliography}{}

\bibitem[Commandeur and Koopman, 2007]{CommandeurKoopman2007}
Commandeur, J.~J. and Koopman, S.~J. (2007).
\newblock {\em An introduction to state space time series analysis}.
\newblock Practical Econometrics. Oxford University Press, Oxford.

\bibitem[de~Jong, 1988]{deJong1988}
de~Jong, P. (1988).
\newblock A cross-validation filter for time series models.
\newblock {\em Biometrika}, 75(3):594--600.

\bibitem[de~Jong and Penzer, 1998]{deJongPenzer1998}
de~Jong, P. and Penzer, J. (1998).
\newblock Diagnosing shocks in time series.
\newblock {\em Journal of the American Statistical Association}, 93(442):796--806.

\bibitem[Harvey and Koopman, 1992]{HarveyKoopman1992}
Harvey, A. and Koopman, S.~J. (1992).
\newblock Diagnostic checking of unobserved-components time series models.
\newblock {\em Journal of Business and Economic Statistics,}, 10:377--389.

\bibitem[Harvey et~al., 1998]{Harveyetal1998}
Harvey, A., Koopman, S.~J., and Penzer, J. (1998).
\newblock Messy time series: a unified approach.
\newblock {\em Advances in Econometrics}, 13:103--143.

\bibitem[Holmes, 2012]{Holmes2010}
Holmes, E.~E. (2012).
\newblock Derivation of the {EM} algorithm for constrained and unconstrained {MARSS} models.
\newblock Technical report, arXiv:1302.3919 [stat.ME].

\bibitem[Shumway and Stoffer, 2006]{ShumwayStoffer2006}
Shumway, R. and Stoffer, D. (2006).
\newblock {\em Time series analysis and its applications}.
\newblock Springer-Science+Business Media, LLC, New York, New York, 2nd edition.

\end{thebibliography}
Loading

0 comments on commit 65d5d1f

Please sign in to comment.