Skip to content

Commit 355f63d

Browse files
authored
Merge pull request #16 from nimble-dev/HMM-error-fix
0.3.0
2 parents 4ad524f + c1718bf commit 355f63d

25 files changed

+1154
-1023
lines changed

.Rbuildignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@
55
\.RDataTmp
66
run_tests\.R
77
^\.travis\.yml$
8-
^doc$
9-
^Meta$
10-
\.Rmd$

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
.Ruserdata
55
.RDataTmp
66
..Rcheck
7+
doc
8+
Meta
9+
inst/doc
10+
nimbleEcology.Rproj

DESCRIPTION

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
Package: nimbleEcology
22
Type: Package
33
Title: Distributions for Ecological Models in 'nimble'
4-
Version: 0.2.2
4+
Version: 0.3.0
55
Maintainer: Benjamin R. Goldstein <ben.goldstein@berkeley.edu>
66
Authors@R: c(person("Benjamin R.", "Goldstein", role = c("aut", "cre"),
77
email = "ben.goldstein@berkeley.edu"),
88
person("Daniel", "Turek", role = "aut"),
99
person("Lauren", "Ponisio", role = "aut"),
1010
person("Perry", "de Valpine", role = "aut"))
11-
Date: 2020-05-12
11+
Date: 2020-05-27
1212
Description: Common ecological distributions for 'nimble' models in the form of nimbleFunction objects.
1313
Includes Cormack-Jolly-Seber, occupancy, dynamic occupancy, hidden Markov, dynamic hidden Markov, and N-mixture models.
1414
(Jolly (1965) <DOI: 10.2307/2333826>, Seber (1965) <DOI: 10.2307/2333827>, Turek et al. (2016) <doi:10.1007/s10651-016-0353-z>).
1515
License: GPL-3
1616
Copyright: Copyright (c) 2019, Perry de Valpine, Ben Goldstein, Daniel Turek, Lauren Ponisio
1717
Depends: R (>= 3.4.0), nimble
1818
Encoding: UTF-8
19+
VignetteBuilder: knitr
1920
LazyData: true
2021
URL: https://github.com/nimble-dev/nimbleEcology
2122
Collate:
@@ -29,4 +30,5 @@ Collate:
2930
RoxygenNote: 7.1.0
3031
Suggests:
3132
rmarkdown,
33+
knitr,
3234
testthat (>= 2.1.0)

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Generated by roxygen2: do not edit by hand
21

32
export(dCJS_ss)
43
export(dCJS_sv)

R/dCJS.R

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#'
99
#' @name dCJS
1010
#'
11-
#' @param x capture-history vector of 0s (not captured) and 1s (captured).
11+
#' @param x capture history vector of 0s (not captured) and 1s (captured).
1212
#' Include the initial capture, so \code{x[1]} should equal 1.
1313
#' @param probSurvive survival probability, either a time-independent scalar
1414
#' (for dCJS_s*) or a time-dependent vector (for dCJS_v*) with length
@@ -50,9 +50,8 @@
5050
#' \code{nimble} model code (via \code{nimbleCode}), \code{len} must be provided
5151
#' (even though it may seem redundant).
5252
#'
53-
#' For more explanation, see
54-
#' \href{../doc/Introduction_to_nimbleEcology.html}{package vignette} (or
55-
#' \code{vignette("Introduction_to_nimbleEcology")}).
53+
#' For more explanation, see package vignette
54+
#' (\code{vignette("Introduction_to_nimbleEcology")}).
5655
#'
5756
#' Compared to writing \code{nimble} models with a discrete latent state for
5857
#' true alive/dead status at each time and a separate scalar datum for each
@@ -108,7 +107,6 @@
108107
#' @importFrom stats rbinom runif dbinom
109108
#'
110109
#' @examples
111-
#' \donttest{
112110
#' # Set up constants and initial values for defining the model
113111
#' dat <- c(1,1,0,0,0) # A vector of observations
114112
#' probSurvive <- c(0.6, 0.3, 0.3, 0.1)
@@ -130,7 +128,6 @@
130128
#' # Calculate log probability of data from the model
131129
#' CJS_model$calculate()
132130
#' # Use the model for a variety of other purposes...
133-
#' }
134131

135132

136133
NULL

R/dDHMM.R

Lines changed: 190 additions & 49 deletions
Large diffs are not rendered by default.

R/dDynOcc.R

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
#'
4747
#' The probability (or likelihood) of observation \code{x[t, o]} depends on
4848
#' the occupancy status of the site at time t-1, the transitition
49-
#' probability of persistence (\code{probPersist} or \code{probPersist[t]}),
50-
#' colonization (\code{probColonize} or \code{probColonize[t]}), and a
49+
#' probability of persistence (\code{probPersist} or \code{probPersist[t-1]}),
50+
#' colonization (\code{probColonize} or \code{probColonize[t-1]}), and a
5151
#' detection probability (\code{p}, \code{p[t]}, or \code{p[t, o]}).
5252
#'
5353
#' The first two letters following the 'dDynOcc_' indicate whether the
@@ -57,7 +57,7 @@
5757
#' probabilities \code{probColonize[1:(T-1)]}.
5858
#'
5959
#' When vectors, \code{probColonize} and \code{probPersist} may be of any
60-
#' length greater than \code{length(x) - 1}. Only the first \code{length(x) - 1}
60+
#' length greater than or equal to \code{length(x) - 1}. Only the first \code{length(x) - 1}
6161
#' indices are used, each corresponding to the transition from time t to t+1
6262
#' (e.g. \code{probColonize[2]} describes the transition probability from
6363
#' t = 2 to t = 3). All extra values are ignored. This is to make it easier to
@@ -76,9 +76,8 @@
7676
#' \code{end = c(4,4,3)}. In this case, the value of \code{x[4,4]} would
7777
#' be ignored.
7878
#'
79-
#' For more explanation, see
80-
#' \href{../doc/Introduction_to_nimbleEcology.html}{package vignette} (or
81-
#' \code{vignette("Introduction_to_nimbleEcology")}).
79+
#' For more explanation, see package vignette
80+
#' (\code{vignette("Introduction_to_nimbleEcology")}).
8281
#'
8382
#' Compared to writing \code{nimble} models with a discrete latent state for
8483
#' true occupancy status and a separate scalar datum for each observation, use
@@ -115,13 +114,13 @@
115114
#'
116115
#' If an algorithm using a \code{nimble} model with this declaration
117116
#' needs to generate a random draw for \code{detections[1:T, 1:O]}, it
118-
#' will make a similar invocation of \code{rDynOcc_svm}, with \code{n = 1}.
117+
#' will make a similar invocation of \code{rDynOcc_ssm}, with \code{n = 1}.
119118
#'
120119
#' If the colonization probabilities are time-dependent, one would use:
121120
#'
122121
#' \code{detections[1:T] ~ dDynOcc_svm(nrep, init = init_prob,
123122
#' probPersist = persistence_prob,
124-
#' probColonize = colonization_prob[1:(T-1)], p = p[1:S, 1:T])}
123+
#' probColonize = colonization_prob[1:(T-1)], p = p[1:T, 1:O])}
125124
#'
126125
#' @return
127126
#' For \code{dDynOcc_***}: the probability (or likelihood) or log probability
@@ -131,7 +130,6 @@
131130
#' @seealso For basic occupancy models, see documentation for
132131
#' \code{\link{dOcc}}.
133132
#' @examples
134-
#' \donttest{
135133
#' # Set up constants and initial values for defining the model
136134
#' x <- matrix(c(0,0,0,0,
137135
#' 1,1,1,0,
@@ -176,7 +174,6 @@
176174
#' # Calculate log probability of data from the model
177175
#' DynOcc_model$calculate("x")
178176
#' # Use the model for a variety of other purposes...
179-
#' }
180177

181178
NULL
182179
#' @rdname dDynOcc

0 commit comments

Comments
 (0)