|
133 | 133 | #' @examples |
134 | 134 | #' \donttest{ |
135 | 135 | #' # 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, |
137 | 137 | #' 1,1,1,0, |
138 | 138 | #' 0,0,0,0, |
139 | 139 | #' 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) |
143 | 143 | #' init <- 0.7 |
144 | 144 | #' probPersist <- 0.5 |
145 | 145 | #' probColonize <- 0.2 |
146 | | -#' p <- 0.8 |
| 146 | +#' p <- matrix(rep(0.5, 20), nrow = 4) |
147 | 147 | #' |
148 | 148 | #' |
149 | 149 | #' # Define code for a nimbleModel |
150 | 150 | #' nc <- nimbleCode({ |
151 | 151 | #' |
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]) |
154 | 155 | #' |
155 | 156 | #' init ~ dunif(0,1) |
156 | 157 | #' |
|
167 | 168 | #' }) |
168 | 169 | #' |
169 | 170 | #' # 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), |
171 | 173 | #' inits = list(p = p, probPersist = probPersist, |
172 | 174 | #' init = init, probColonize = probColonize)) |
173 | 175 | #' |
174 | 176 | #' # Calculate log probability of data from the model |
175 | | -#' DynOcc_model$calculate() |
| 177 | +#' DynOcc_model$calculate("x") |
176 | 178 | #' # Use the model for a variety of other purposes... |
177 | 179 | #' } |
178 | 180 |
|
|
0 commit comments