Skip to content

Commit 3089b6c

Browse files
authored
Merge pull request #12 from nimble-dev/typo_fixes
Typo fixes into master
2 parents 7ce6c91 + 9b4e106 commit 3089b6c

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
Package: nimbleEcology
22
Type: Package
33
Title: Distributions for Ecological Models in 'nimble'
4-
Version: 0.2.0
4+
Version: 0.2.1
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-02-20
11+
Date: 2020-04-03
1212
Description: Common ecological distributions for 'nimble' models in the form of nimbleFunction objects.
13-
Includes Cormack-Jolly-Seber, occupancy, dynamic occupancy, hidden Markov, and dynamic hidden Markov models.
13+
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) <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

R/dCJS.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@
117117
#'
118118
#' # Define code for a nimbleModel
119119
#' nc <- nimbleCode({
120-
#' x[1:4] ~ dCJS_vs(probSurvive, probCapture, len = 4)
121-
#' probSurvive ~ dunif(0,1)
120+
#' x[1:4] ~ dCJS_vs(probSurvive[1:4], probCapture, len = 4)
121+
#' probCapture ~ dunif(0,1)
122122
#' for (i in 1:4) probSurvive[i] ~ dunif(0, 1)
123123
#' })
124124
#'

R/dDHMM.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,19 @@
131131
#' # Define code for a nimbleModel
132132
#' nc <- nimbleCode({
133133
#' x[1:4] ~ dDHMM(init[1:3], probObs = probObs[1:3, 1:2],
134-
#' probTrans = probTrans[1:3, 1:3, 1:4], len = 4)
134+
#' probTrans = probTrans[1:3, 1:3, 1:3], len = 4)
135135
#'
136136
#' for (i in 1:3) {
137137
#' init[i] ~ dunif(0,1)
138138
#'
139139
#' for (j in 1:3) {
140-
#' for (t in 1:4) {
140+
#' for (t in 1:3) {
141141
#' probTrans[i,j,t] ~ dunif(0,1)
142142
#' }
143143
#' }
144144
#'
145145
#' probObs[i, 1] ~ dunif(0,1)
146-
#' probObs[i, 2] <- 1 - probObs[1,i]
146+
#' probObs[i, 2] <- 1 - probObs[i,1]
147147
#' }
148148
#' })
149149
#'

R/dDynOcc.R

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,24 +133,25 @@
133133
#' @examples
134134
#' \donttest{
135135
#' # Set up constants and initial values for defining the model
136-
#' x <- matrix(c(0,0,NA,0,
136+
#' x <- matrix(c(0,0,0,0,
137137
#' 1,1,1,0,
138138
#' 0,0,0,0,
139139
#' 0,0,1,0,
140-
#' 0,0,0,NA), nrow = 4)
141-
#' start <- c(1,1,2,1)
142-
#' end <- c(5,5,5,4)
140+
#' 0,0,0,0), nrow = 4)
141+
#' start <- c(1,1,2,1,1)
142+
#' end <- c(5,5,5,4,5)
143143
#' init <- 0.7
144144
#' probPersist <- 0.5
145145
#' probColonize <- 0.2
146-
#' p <- 0.8
146+
#' p <- matrix(rep(0.5, 20), nrow = 4)
147147
#'
148148
#'
149149
#' # Define code for a nimbleModel
150150
#' nc <- nimbleCode({
151151
#'
152-
#' x[1:2, 1:5] ~ dDynOcc_vvm(nrep[1:2], init,
153-
#' probPersist[1:2], probColonize[1:2], p[1:2,1:5])
152+
#' x[1:2, 1:5] ~ dDynOcc_vvm(init,
153+
#' probPersist[1:2], probColonize[1:2], p[1:2,1:5],
154+
#' start = start[1:4], end = end[1:4])
154155
#'
155156
#' init ~ dunif(0,1)
156157
#'
@@ -167,12 +168,13 @@
167168
#' })
168169
#'
169170
#' # Build the model, providing data and initial values
170-
#' DynOcc_model <- nimbleModel(nc, data = list(x = dat, nrep = nrep),
171+
#' DynOcc_model <- nimbleModel(nc, data = list(x = x),
172+
#' constants = list(start = start, end = end),
171173
#' inits = list(p = p, probPersist = probPersist,
172174
#' init = init, probColonize = probColonize))
173175
#'
174176
#' # Calculate log probability of data from the model
175-
#' DynOcc_model$calculate()
177+
#' DynOcc_model$calculate("x")
176178
#' # Use the model for a variety of other purposes...
177179
#' }
178180

R/dHMM.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,16 @@
137137
#'
138138
#' # Define code for a nimbleModel
139139
#' nc <- nimbleCode({
140-
#' x[1:5] ~ dHMM(init[1:3], probObs = probObs[1:2,1:3],
140+
#' x[1:5] ~ dHMM(init[1:3], probObs = probObs[1:3,1:2],
141141
#' probTrans = probTrans[1:3, 1:3], len = 5)
142142
#'
143143
#' for (i in 1:3) {
144-
#' init[i] ~ dunif(0,1)
145-
#'
146144
#' for (j in 1:3) {
147145
#' probTrans[i,j] ~ dunif(0,1)
148146
#' }
149147
#'
150148
#' probObs[i, 1] ~ dunif(0,1)
151-
#' probObs[i, 2] <- 1 - probObs[1,i]
149+
#' probObs[i, 2] <- 1 - probObs[i, 1]
152150
#' }
153151
#' })
154152
#'

R/dNmixture.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
#' inits = list(lambda = lambda,
147147
#' prob = prob))
148148
#' # Calculate log probability of data from the model
149-
#' nmix_model$calculate()
149+
#' nmix$calculate()
150150
#' # Use the model for a variety of other purposes...
151151
#' }
152152

@@ -209,7 +209,7 @@ dNmixture_s <- nimbleFunction(
209209
Nmax = double(0, default = -1),
210210
len = double(),
211211
log = integer(0, default = 0)) {
212-
if (length(x) != len) stop("in dNmixture_v, len must equal length(x).")
212+
if (length(x) != len) stop("in dNmixture_s, len must equal length(x).")
213213

214214
# Lambda cannot be negative
215215
if (lambda < 0) {

0 commit comments

Comments
 (0)