Skip to content

Commit e1d9c27

Browse files
author
Ian Jonsen
committed
more ex speedup
1 parent a795daa commit e1d9c27

15 files changed

+54
-124
lines changed

R/bsam-package.R

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
#' \dontrun{
3838
#' # Fit DCRW model for state filtering and regularization -
3939
#' # using trivial adapt & samples values for speed
40-
#' data(ellie)
41-
#' fit <- fit_ssm(ellie, model = "DCRW", tstep = 1, adapt = 100, samples = 100,
40+
#' data(ellie1)
41+
#' fit <- fit_ssm(ellie1, model = "DCRW", tstep = 1, adapt = 10, samples = 100,
4242
#' thin = 1, span = 0.2)
4343
#' diag_ssm(fit)
4444
#' map_ssm(fit)
@@ -54,9 +54,9 @@ NULL
5454

5555

5656

57-
##' @name ellie
57+
##' @name ellie1
5858
##' @docType data
59-
##' @title Elephant seal Argos satellite data (2 individuals)
59+
##' @title Elephant seal Argos satellite data (1 individual)
6060
##' @format .RData
6161
##' @keywords data
6262
##' @description Example elephant seal Argos tracking data. Data were sourced from
@@ -65,4 +65,13 @@ NULL
6565
##' Strategy and the Super Science Initiative.
6666
NULL
6767

68-
68+
##' @name ellie2
69+
##' @docType data
70+
##' @title Elephant seal Argos satellite data (2 individuals)
71+
##' @format .RData
72+
##' @keywords data
73+
##' @description Example elephant seal Argos tracking data. Data were sourced from
74+
##' the Integrated Marine Observing System (IMOS) - IMOS is supported by the
75+
##' Australian Government through the National Collaborative Research Infrastructure
76+
##' Strategy and the Super Science Initiative.
77+
NULL

R/diag_ssm.R

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@
1212
#' increasing number of iterations. See the \code{coda} package for further details.
1313
#' @references Brooks SP, Gelman A (1998) General methods for monitoring convergence of
1414
#' iterative simulations. Journal of Computational and Graphical Statistics 7:434-455
15-
#' @examples
16-
#' \dontrun{
17-
#' data(ellie)
18-
#' fit.s <- fit_ssm(ellie, model = "DCRWS", tstep = 1, adapt = 100, samples = 100,
19-
#' thin = 1, span = 0.1)
20-
#' diag_ssm(fit.s)
21-
#'
22-
#' # increase burnin, posterior sample numbers, and thinning factor
23-
#' fit.s2 <- fit_ssm(ellie, model = "DCRWS", tstep = 1, adapt = 100, samples = 100,
24-
#' thin = 1, span = 0.1)
25-
#' diag_ssm(fit.s2)
26-
#' }
2715
#' @importFrom coda autocorr.plot traceplot gelman.plot as.mcmc.list nvar varnames<-
2816
#' @export
2917
#'

R/fit_ssm.R

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,14 @@
6969
#'
7070
#' # Fit DCRW model for state filtering and regularization -
7171
#' # using trivial adapt & samples values for speed
72-
#' data(ellie)
73-
#' fit <- fit_ssm(ellie, model = "DCRW", tstep = 2, adapt = 100, samples = 100,
72+
#' data(ellie1)
73+
#' fit <- fit_ssm(ellie1, model = "DCRW", tstep = 4, adapt = 10, samples = 100,
7474
#' thin = 1, span = 0.2)
75-
#' diag_ssm(fit)
76-
#' map_ssm(fit)
77-
#' plot_fit(fit)
78-
#' result <- get_summary(fit)
7975
#'
80-
#' \dontrun{
76+
#' \donttest{
8177
#' # Fit DCRWS model for state filtering, regularization and behavioural state estimation -
8278
#' # using trivial adapt & samples values for speed
83-
#' fit.s <- fit_ssm(ellie, model = "DCRWS", tstep = 2, adapt = 100, samples = 100,
79+
#' fit.s <- fit_ssm(ellie1, model = "DCRWS", tstep = 2, adapt = 10, samples = 100,
8480
#' thin = 1, span = 0.2)
8581
#' diag_ssm(fit.s)
8682
#' map_ssm(fit.s)
@@ -91,12 +87,13 @@
9187
#' # this may provide better parameter and behavioural state estimation
9288
#' # by borrowing strength across multiple track datasets -
9389
#' # using trivial adapt & samples values for speed
94-
#' hfit.s <- fit_ssm(ellie, model = "hDCRWS", tstep = 2, adapt = 100, samples = 100,
90+
#' data(ellie2)
91+
#' hfit.s <- fit_ssm(ellie2, model = "hDCRWS", tstep = 2, adapt = 10, samples = 100,
9592
#' thin = 1, span = 0.2)
96-
#' diag_ssm(hfit.s)
97-
#' map_ssm(hfit.s)
98-
#' plot_fit(hfit.s)
99-
#' result.hs <- get_summary(hfit.s)
93+
#' diag_ssm(hfit.s)
94+
#' map_ssm(hfit.s)
95+
#' plot_fit(hfit.s)
96+
#' result.hs <- get_summary(hfit.s)
10097
#' }
10198
#' @importFrom tibble as_tibble
10299
#' @export

R/get_summary.R

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,6 @@
1111
#' @return a summary data.frame printed either to the console (default) or written as .csv to a
1212
#' specified file.
1313
#'
14-
#' @examples
15-
#' \dontrun{
16-
#' data(ellie)
17-
#' fit <- fit_ssm(ellie, model = "DCRW", tstep = 1, adapt = 100, samples = 100,
18-
#' thin = 1, span = 0.1)
19-
#'
20-
#' ## print to console
21-
#' get_summary(fit)
22-
#'
23-
#' ## export to .csv file
24-
#' get_summary(fit, file = "ellie_dcrw.csv")
25-
#'
26-
#' ## plot track of second animal (posterior mean longitude and latitude)
27-
#' p <- ggplot(data = subset(get_summary(fit), id == unique(id)[2])) +
28-
#' geom_point(aes(lat, lon), col = "firebrick", size = 2)
29-
#' p
30-
#'
31-
#' ## overlay posterior median longitude and latitude
32-
#' p + geom_point(aes(lat.5, lon.5), col = "dodgerblue", size = 1)
33-
#' }
3414
#' @importFrom utils write.csv
3515
#' @export
3616

R/plot_fit.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,6 @@
88
#' @return Observed locations are plotted as filled circles and estimated locations as blue
99
#' lines with the 95\% credible interval as a ribbon. Uses \code{ggplot2} plotting functions.
1010
#'
11-
#' @examples
12-
#' \dontrun{
13-
#' data(ellie)
14-
#' fit.s <- fit_ssm(ellie, model = "DCRWS", tstep = 1, adapt = 100, samples = 100,
15-
#' thin = 1, span = 0.1)
16-
#' plot_fit(fit.s)
17-
#'
18-
#' hfit.s <- fit_ssm(ellie, model = "hDCRWS", tstep = 1, adapt = 100, samples = 100,
19-
#' thin = 1, span = 0.1)
20-
#' plot_fit(hfit.s)
21-
#' }
2211
#' @importFrom ggplot2 ggplot aes ggtitle geom_point scale_color_gradient2 xlab ylab aes_string
2312
#' @importFrom ggplot2 ylim geom_line geom_ribbon
2413
#' @importFrom gridExtra grid.arrange

data/ellie.RData

-8.63 KB
Binary file not shown.

data/ellie1.RData

3.92 KB
Binary file not shown.

data/ellie2.RData

6.33 KB
Binary file not shown.

man/bsam-package.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/diag_ssm.Rd

Lines changed: 0 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)