Skip to content

Commit

Permalink
Merge branch 'cran-pretest'
Browse files Browse the repository at this point in the history
  • Loading branch information
jarioksa committed Aug 11, 2022
2 parents 80e3170 + 7ef3e94 commit cc341c0
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 50 deletions.
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Package: Hmsc
Title: Hierarchical Model of Species Communities
Type: Package
Version: 3.0-12
Version: 3.0-13
Authors@R: c(person(given = "Gleb", family="Tikhonov", role="aut"),
person(given="Otso", family="Ovaskainen",
email="otso.ovaskainen@helsinki.fi",
comment = c(ORCID="0000-0001-9750-4421"), role=c("aut","cre")),
person(given="Jari", family="Oksanen", role="aut"),
comment = c(ORCID="0000-0001-9750-4421"), role=c("aut", "cre")),
person(given="Jari", family="Oksanen", role=c("aut"),
email="jhoksane@gmail.com"),
person(given="Melinda", family=c("de", "Jonge"), role="aut"),
person(given="Oystein", family="Opedal", role="aut"),
person(given="Tad", family="Dallas", role="aut"))
Expand All @@ -16,11 +17,11 @@ Description: Hierarchical Modelling of Species Communities (HMSC) is
Markov chain Monte Carlo (MCMC) sampling (Tikhonov et al. (2020)
<doi:10.1111/2041-210X.13345>).
License: GPL-3 | file LICENSE
URL: https://www.helsinki.fi/en/researchgroups/statistical-ecology/hmsc
URL: https://www.helsinki.fi/en/researchgroups/statistical-ecology/software/hmsc
BugReports: https://github.com/hmsc-r/HMSC/issues/
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.2
RoxygenNote: 7.2.1
Suggests: R.rsp,
testthat,
corrplot
Expand Down
17 changes: 8 additions & 9 deletions R/c.Hmsc.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
#' @return An \code{\link{Hmsc}} model with chains of posterior
#' samples.
#' @examples
#' ## Fitted model with two chains
#' TD$m
#' ## New chains: check carefully that these are sampled exactly like
#' ## the previous model
#' m2 <- sampleMcmc(TD$m, nChains=1, samples=100, thin=1, transient=50,
#' verbose=0)
#' ## Now three chains
#' mnew <- c(TD$m, m2)
#' mnew
#' ## Fit a toy model with two chains
#' m1 <- sampleMcmc(TD$m, samples=10, transient=5, nChains=2, verbose=0)
#' ## Need more data? Add chains: check carefully that these are
#' ## sampled exactly like the previous model
#' m2 <- sampleMcmc(TD$m, nChains=2, samples=10, transient=5, verbose=0)
#' ## Now four chains
#' m4 <- c(m1, m2)
#' m4
#'
#' @export
`c.Hmsc` <-
Expand Down
2 changes: 1 addition & 1 deletion R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ predict.Hmsc = function(object, post=poolMcmcChains(object$postList), XData=NULL
Gradient=NULL, Yc=NULL, mcmcStep=1, expected=FALSE,
predictEtaMean=FALSE, predictEtaMeanField=FALSE,
nParallel = 1,
useSocket = .Platform$OS.type == "windows", ...)
useSocket = TRUE, ...)
{
## check valid nParallel
nParallel <- min(nParallel, detectCores())
Expand Down
2 changes: 1 addition & 1 deletion R/sampleMcmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ sampleMcmc =
function(hM, samples, transient=0, thin=1, initPar=NULL,
verbose, adaptNf=rep(transient,hM$nr),
nChains=1, nParallel=1,
useSocket = .Platform$OS.type == "windows",
useSocket = TRUE,
dataParList=NULL, updater=list(),
fromPrior = FALSE, alignPost = TRUE)
{
Expand Down
12 changes: 6 additions & 6 deletions inst/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version 3.0-12 (not released, only in github)
Version 3.0-13
==============

### New Features
Expand All @@ -18,7 +18,7 @@ Version 3.0-12 (not released, only in github)
but other platforms can profit from the use of fork clusters which
may have lower memory use and are faster to set up, and also may be
marginally faster. The choice can be made with new argument
`useSocket` which `TRUE` in Windows.
`useSocket` (defaults `TRUE`).

* Updaters in `sampleMcmc` can occasionally fail in extreme `Hmsc`
models. This is no longer an error that stops analysis, but sampling
Expand All @@ -27,7 +27,7 @@ Version 3.0-12 (not released, only in github)
of failures, the sampling is safe to use. If there are updater
errors only in some chains, these chains can be removed, but other
chains can be used. See
[issue #123](https://github.com/hmsc-r/HMCS/issue/123).
[issue #123](https://github.com/hmsc-r/HMSC/issues/123).

* New experimental function `pcomputePredictedValues` with more
aggressive parallelization than `computePredictedValues`. In old
Expand All @@ -46,8 +46,8 @@ Version 3.0-12 (not released, only in github)
instead of spatial coordinates.

* `constructGradient` provides wider choice of coordinates for
centroid, including user-set and infinite (meaning no spatial
dependence) coordinates.
centroid of `new_unit`, including user-set and infinite (meaning no
spatial dependence) coordinates.

* Detect cases when user tries to analyse posterior samples of
non-sampled `Hmsc` object to avoid confusing error messages such as
Expand Down Expand Up @@ -85,7 +85,7 @@ Version 3.0-12 (not released, only in github)
`X` instead of model frame `XData` and model formula
`XFormula`. Concerns functions `biPlot`,
`computeVariancePartitioning` and `constructGradient`. Fixes
[issue #126](https://github.com/dshmsc-r/HMSC/issues/126).
[issue #126](https://github.com/hmsc-r/HMSC/issues/126).

* `biPlot` has improved handling of colour scaling of continuous
variables.
Expand Down
2 changes: 1 addition & 1 deletion man/Hmsc-package.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Hierarchical Modelling of Species Communities (Hmsc) is a
\seealso{
Useful links:
\itemize{
\item \url{https://www.helsinki.fi/en/researchgroups/statistical-ecology/hmsc}
\item \url{https://www.helsinki.fi/en/researchgroups/statistical-ecology/software/hmsc}
\item Report bugs at \url{https://github.com/hmsc-r/HMSC/issues/}
}

Expand Down
17 changes: 8 additions & 9 deletions man/c.Hmsc.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/predict.Hmsc.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/sampleMcmc.Rd

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

34 changes: 18 additions & 16 deletions tests/Examples/Hmsc-Ex.Rout.save
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
Expand Down Expand Up @@ -129,20 +129,22 @@ Loading required package: coda
>
> ### ** Examples
>
> ## Fitted model with two chains
> TD$m
Hmsc object with 50 sampling units, 4 species, 3 covariates, 3 traits and 2 random levels
Posterior MCMC sampling with 2 chains each with 100 samples, thin 1 and transient 50
> ## New chains: check carefully that these are sampled exactly like
> ## the previous model
> m2 <- sampleMcmc(TD$m, nChains=1, samples=100, thin=1, transient=50,
+ verbose=0)
> ## Fit a toy model with two chains
> m1 <- sampleMcmc(TD$m, samples=10, transient=5, nChains=2, verbose=0)
setting updater$Gamma2=FALSE due to specified phylogeny matrix
Computing chain 1
Computing chain 2
> ## Need more data? Add chains: check carefully that these are
> ## sampled exactly like the previous model
> m2 <- sampleMcmc(TD$m, nChains=2, samples=10, transient=5, verbose=0)
setting updater$Gamma2=FALSE due to specified phylogeny matrix
> ## Now three chains
> mnew <- c(TD$m, m2)
> mnew
Computing chain 1
Computing chain 2
> ## Now four chains
> m4 <- c(m1, m2)
> m4
Hmsc object with 50 sampling units, 4 species, 3 covariates, 3 traits and 2 random levels
Posterior MCMC sampling with 3 chains each with 100 samples, thin 1 and transient 50
Posterior MCMC sampling with 4 chains each with 10 samples, thin 1 and transient 5
>
>
>
Expand Down Expand Up @@ -173,7 +175,7 @@ Posterior MCMC sampling with 3 chains each with 100 samples, thin 1 and transien
>
> ### Name: computePredictedValues
> ### Title: computePredictedValues
> ### Aliases: computePredictedValues
> ### Aliases: computePredictedValues pcomputePredictedValues
>
> ### ** Examples
>
Expand Down Expand Up @@ -549,7 +551,7 @@ Chain 1, iteration 10 of 10 (sampling)
> cleanEx()
> options(digits = 7L)
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
Time elapsed: 4.28 0.087 4.392 0.001 0.001
Time elapsed: 2.824 0.061 2.9 0.004 0.007
> grDevices::dev.off()
null device
1
Expand Down
Binary file modified vignettes/vignette_1_univariate.pdf
Binary file not shown.
Binary file modified vignettes/vignette_2_multivariate_low.pdf
Binary file not shown.
Binary file modified vignettes/vignette_3_multivariate_high.pdf
Binary file not shown.
Binary file modified vignettes/vignette_4_spatial.pdf
Binary file not shown.
Binary file modified vignettes/vignette_5_performance.pdf
Binary file not shown.

0 comments on commit cc341c0

Please sign in to comment.