diff --git a/DESCRIPTION b/DESCRIPTION index 937d91f..d8950be 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: spatPomp Type: Package Title: Inference for Spatiotemporal Partially Observed Markov Processes -Version: 0.36.1 -Date: 2024-08-20 +Version: 0.37.0 +Date: 2024-10-25 Authors@R: c( person("Kidus", "Asfaw", email = "kidusasfaw1990@gmail.com", role = c("aut")), person("Edward", "Ionides", email = "ionides@umich.edu",role = c("cre","aut")), @@ -58,6 +58,7 @@ Collate: 'he10mle.R' 'ienkf.R' 'igirf.R' + 'init.R' 'iubf.R' 'loglik.R' 'lorenz.R' diff --git a/R/abf.R b/R/abf.R index 983257d..c3dca16 100644 --- a/R/abf.R +++ b/R/abf.R @@ -109,7 +109,7 @@ setMethod( signature=signature(object="spatPomp"), function (object, Nrep, Np, nbhd, params, tol = 1.0e-100, - ..., verbose=getOption("verbose",FALSE)) { + ..., verbose=getOption("spatPomp_verbose",FALSE)) { ep <- paste0("in ",sQuote("abf"),": ") @@ -188,7 +188,7 @@ setMethod( signature=signature(object="abfd_spatPomp"), function (object, Nrep, Np, nbhd, tol, ..., - verbose = getOption("verbose", FALSE)) { + verbose = getOption("spatPomp_verbose", FALSE)) { if (missing(Np)) Np <- object@Np if (missing(Nrep)) Nrep <- object@Nrep if (missing(nbhd)) nbhd <- object@nbhd diff --git a/R/abfir.R b/R/abfir.R index 1cffb69..777aa37 100644 --- a/R/abfir.R +++ b/R/abfir.R @@ -92,7 +92,7 @@ setMethod( signature=signature(object="spatPomp"), function (object, Np, Nrep, nbhd, Ninter, tol = (1e-100), params, ..., - verbose=getOption("verbose",FALSE) ) { + verbose=getOption("spatPomp_verbose",FALSE) ) { ep <- paste0("in ",sQuote("abfir"),": ") ## declare global variable since foreach's u uses non-standard evaluation i <- 1 diff --git a/R/bpfilter.R b/R/bpfilter.R index e811e75..d8a16d8 100644 --- a/R/bpfilter.R +++ b/R/bpfilter.R @@ -127,7 +127,7 @@ setMethod( setMethod( "bpfilter", signature=signature(object="spatPomp"), - function (object, Np, block_size, block_list, save_states, filter_traj, ..., verbose=getOption("verbose", FALSE)) { + function (object, Np, block_size, block_list, save_states, filter_traj, ..., verbose=getOption("spatPomp_verbose", FALSE)) { ep = paste0("in ",sQuote("bpfilter"),": ") if(missing(save_states)) save_states <- FALSE @@ -172,7 +172,7 @@ setMethod( setMethod( "bpfilter", signature=signature(object="bpfilterd_spatPomp"), - function (object, Np, block_size, block_list, save_states, filter_traj, ..., verbose=getOption("verbose", FALSE)) { + function (object, Np, block_size, block_list, save_states, filter_traj, ..., verbose=getOption("spatPomp_verbose", FALSE)) { ep = paste0("in ",sQuote("bpfilter"),": ") if(missing(save_states)) save_states <- FALSE diff --git a/R/conc.R b/R/conc.R index 687e62a..033d153 100644 --- a/R/conc.R +++ b/R/conc.R @@ -1,4 +1,4 @@ -##' Concatenate +##' Concatenate spatPomp objects into a listie ##' ##' @description Internal methods to concatenate objects into useful listie. ##' @details Not exported. diff --git a/R/enkf.R b/R/enkf.R index 47bcfc2..334dc59 100644 --- a/R/enkf.R +++ b/R/enkf.R @@ -95,7 +95,7 @@ setMethod( signature=signature(data="spatPomp"), function (data, Np, - ..., verbose = getOption("verbose", FALSE)) { + ..., verbose = getOption("spatPomp_verbose", FALSE)) { tryCatch( enkf.internal( data, diff --git a/R/eunit_measure.R b/R/eunit_measure.R index 195d5af..2a38b8d 100644 --- a/R/eunit_measure.R +++ b/R/eunit_measure.R @@ -1,4 +1,4 @@ -#' eunit_measure +#' Expectation of the measurement model for one unit #' #' \code{eunit_measure} evaluates the expectation of a unit's observation given the entire state #' @name eunit_measure diff --git a/R/girf.R b/R/girf.R index c53b248..9a754ee 100644 --- a/R/girf.R +++ b/R/girf.R @@ -127,7 +127,7 @@ setMethod( kind=c('bootstrap','moment'), tol, ..., - verbose = getOption("verbose", FALSE)) { + verbose = getOption("spatPomp_verbose", FALSE)) { if (missing(tol)) tol <- 1e-100 if (missing(Ninter)) Ninter <- length(unit_names(object)) diff --git a/R/ibpf.R b/R/ibpf.R index 75eded9..8085082 100644 --- a/R/ibpf.R +++ b/R/ibpf.R @@ -126,7 +126,7 @@ setMethod( cooling.type="geometric", cooling.fraction.50, block_size, block_list,spat_regression, - ..., verbose = getOption("verbose", FALSE) + ..., verbose = getOption("spatPomp_verbose", FALSE) ){ ep <- paste0("in ",sQuote("ibpf"),": ") if (missing(Nbpf)) pStop_(ep, "Nbpf is required") @@ -189,7 +189,7 @@ setMethod( cooling.type="geometric", cooling.fraction.50, block_size, block_list,spat_regression, - ..., verbose = getOption("verbose", FALSE) + ..., verbose = getOption("spatPomp_verbose", FALSE) ){ ep <- paste0("in ",sQuote("ibpf"),": ") if (!missing(block_list) & !missing(block_size)){ @@ -244,7 +244,7 @@ setMethod( cooling.type="geometric", cooling.fraction.50, block_size, block_list,spat_regression, - ..., verbose = getOption("verbose", FALSE) + ..., verbose = getOption("spatPomp_verbose", FALSE) ) { ep <- paste0("in ",sQuote("ibpf"),": ") if (!missing(block_list) & !missing(block_size)){ diff --git a/R/ienkf.R b/R/ienkf.R index e8e133e..2a68098 100644 --- a/R/ienkf.R +++ b/R/ienkf.R @@ -82,7 +82,7 @@ setMethod( Nenkf = 1, rw.sd, cooling.type = c("geometric", "hyperbolic"), cooling.fraction.50, Np, - ..., verbose = getOption("verbose", FALSE)) { + ..., verbose = getOption("spatPomp_verbose", FALSE)) { tryCatch( ienkf.internal( data, diff --git a/R/igirf.R b/R/igirf.R index 0e990b7..e7b43cd 100644 --- a/R/igirf.R +++ b/R/igirf.R @@ -98,7 +98,7 @@ setMethod( definition=function (data,Ngirf,Np,rw.sd,cooling.type,cooling.fraction.50, Ninter,lookahead=1,Nguide,kind=c('bootstrap', 'moment'), tol = 1e-100, - ..., verbose = getOption("verbose", FALSE)) { + ..., verbose = getOption("spatPomp_verbose", FALSE)) { ep <- paste0("in ", sQuote("igirf") , " : ") if(missing(Ninter)) Ninter <- length(unit_names(data)) @@ -129,7 +129,7 @@ setMethod( signature=signature(data="igirfd_spatPomp"), function (data,Ngirf,Np,rw.sd,cooling.type, cooling.fraction.50, Ninter, lookahead,Nguide,kind=c('bootstrap','moment'),tol, ..., - verbose = getOption("verbose", FALSE)) { + verbose = getOption("spatPomp_verbose", FALSE)) { if (missing(Ngirf)) Ngirf <- data@Ngirf if (missing(rw.sd)) rw.sd <- data@rw.sd if (missing(cooling.type)) cooling.type <- data@cooling.type diff --git a/R/init.R b/R/init.R new file mode 100644 index 0000000..1fa0125 --- /dev/null +++ b/R/init.R @@ -0,0 +1,6 @@ +## set up default verbosity option + +.onAttach <- function(libname,pkgname){ + options(spatPomp_verbose=FALSE) +} + diff --git a/R/iubf.R b/R/iubf.R index 0870e81..2e3a045 100644 --- a/R/iubf.R +++ b/R/iubf.R @@ -86,7 +86,7 @@ setMethod( rw.sd, cooling.type = c("geometric","hyperbolic"), cooling.fraction.50, tol = (1e-18)^17, - verbose = getOption("verbose"),...) { + verbose = getOption("spatPomp_verbose"),...) { ep <- paste0("in ",sQuote("iubf"),": ") if(missing(Nubf)) diff --git a/R/listie.R b/R/listie.R index 18a7bf8..da52de3 100644 --- a/R/listie.R +++ b/R/listie.R @@ -1,6 +1,7 @@ -##' listie +##' listie: List-like objects ##' -##' List-like objects. +##' A listie allows object-oriented behavior on lists of +##' \sQuote{spatPomp} objects ##' ##' @name listie ##' @rdname listie diff --git a/R/loglik.R b/R/loglik.R index 027f48c..c46c597 100644 --- a/R/loglik.R +++ b/R/loglik.R @@ -1,6 +1,6 @@ -##' Log likelihood +##' Log likelihood extractor ##' -##' Extract the estimated log likelihood. +##' Extracts the estimated log likelihood from a fitted model ##' ##' @name logLik ##' @rdname loglik diff --git a/R/lorenz.R b/R/lorenz.R index 887808e..dba4abe 100644 --- a/R/lorenz.R +++ b/R/lorenz.R @@ -1,4 +1,4 @@ -#' Lorenz '96 spatPomp simulator +#' Lorenz '96 spatPomp constructor #' #' Generate a spatPomp object representing a \code{U}-dimensional stochastic Lorenz '96 process with #' \code{N} measurements made at times \eqn{t_n = n * delta_obs}, simulated using an Euler method diff --git a/R/munit_measure.R b/R/munit_measure.R index 6c3ea1b..5cdc5d5 100644 --- a/R/munit_measure.R +++ b/R/munit_measure.R @@ -1,4 +1,4 @@ -#' munit_measure +#' Matching moments for the unit measurement model #' #' \code{munit_measure} returns a moment-matched parameter set given an empirically calculated measurement variance and latent states. #' This is used in \code{girf()} and \code{igirf()} when they are run with \code{kind='moment'}. diff --git a/R/plot.R b/R/plot.R index 0596145..fee5145 100644 --- a/R/plot.R +++ b/R/plot.R @@ -1,69 +1,46 @@ -##' Plotting \code{spatPomp} data +##' Plot methods for \code{spatPomp} objects +##' +##' Visualize data in a \code{spatPomp} object or a derived class. +##' This gives a quick view; the data can be extracted from +##' the object to make a customized plot. ##' -##' Visualize \code{spatPomp} data ##' @name plot ##' @rdname plot ##' @include spatPomp_class.R ##' @param x a \code{spatPomp} object -##' @param log should the data be log-transformed before plotting? +##' @param log should the data be transformed to \code{log10(x+1)} before plotting? ##' This helps in contexts where there are spikes that could take away -##' attention from the dynamics illustrated by the rest of the data. +##' attention from the dynamics illustrated by the rest of the data. ##' @param ncol the number of columns in the grid plot ##' @param type for visualizing an object of class \code{spatPomp}, the user -##' can obtain a grid of line plots by default (\code{'l'}) or a heat map by -##' supplying argument \code{'h'}. +##' can obtain a grid of line plots by default (\code{l}) or a heat map by +##' supplying argument \code{h}. ##' @param plot_unit_names allows suppression of unit names when making ##' a heat map for a large number of units +##' @param params allows selection of a subset of parameters when making +##' a diagnostic plot for a model with many parameters ##' @param ... for visualizing an object of class \code{spatPomp}, the user ##' can add arguments like \code{nrow} to specify the number of rows in the ##' grid. +##' @return a \code{ggplot} plot of class \sQuote{gg} and \sQuote{ggplot}. +##' @importFrom ggplot2 ggplot geom_line aes facet_wrap +##' @importFrom graphics par NULL if(getRversion() >= "2.15.1") utils::globalVariables(c(".")) -##' Plotting output of \code{igirf()} -##' -##' Diagnostic plot for \code{igirf()} -##' @param params the names of the parameters for which the user would like to see a trace plot -##' @name plot-igirfd_spatPomp -##' @rdname plot -##' @importFrom ggplot2 ggplot geom_line aes facet_wrap -##' @importFrom graphics par -##' @aliases plot,igirfd_spatPomp-method -##' @return a \code{ggplot} facet plot of class \sQuote{gg} and \sQuote{ggplot} visualizing -##' the convergence record of running \code{igirf()} with respect to the likelihood and the parameters of the model. -setMethod( - "plot", - signature=signature(x="igirfd_spatPomp"), - definition=function (x, params = names(coef(x)), ncol = 3) { - plot.df <- data.frame(x@traces[,c("loglik", params)]) - cn <- colnames(plot.df) - plot.df <- cbind(c(seq_len(dim(plot.df)[1])), plot.df) - names(plot.df) <- c("iteration", cn) - to.gather <- colnames(plot.df)[2:length(colnames(plot.df))] - to.plot <- plot.df |> tidyr::gather(key = "param", val = "value", tidyr::all_of(to.gather)) |> tail(-1) - ggplot2::ggplot(data = to.plot) + - ggplot2::geom_line(mapping = ggplot2::aes(x = .data$iteration, y = .data$value)) + - ggplot2::facet_wrap(~param, ncol = ncol, scales = "free") - } -) -##' Plotting \code{spatPomp} data -##' -##' Visualize \code{spatPomp} data ##' @name plot-spatPomp ##' @rdname plot ##' @aliases plot,spatPomp-method -##' @return a \code{ggplot} plot of class \sQuote{gg} and \sQuote{ggplot} visualizing -##' the time series data over multiple spatial units via a tile-plot. ##' @export setMethod( "plot", signature=signature(x="spatPomp"), - definition=function (x, type = c('l','h'), log=F, plot_unit_names=T,...) { + definition=function (x, type = c('l','h'), log=FALSE, plot_unit_names=TRUE,...) { df <- as.data.frame(x) - if(log) df[x@unit_obsnames] <- log10(df[x@unit_obsnames]+1) - type = match.arg(type) + type <- match.arg(type) if(type == 'l'){ + if(log) df[x@unit_obsnames] <- df[x@unit_obsnames]+1 unit_nm <- rlang::sym(x@unitname) df[[unit_nm]] <- factor(df[[unit_nm]], levels = x@unit_names) g <- ggplot2::ggplot(data = df, @@ -72,11 +49,14 @@ setMethod( y = !!rlang::sym(x@unit_obsnames) ) ) + + ggplot2::labs(y=paste0(x@unit_obsnames,"+1")) + + ggplot2::scale_y_continuous(transform=if(log) "log10" else "identity") + ggplot2::geom_line() + ggplot2::facet_wrap(unit_nm, ...) return(g) } if(type == 'h'){ + if(log) df[x@unit_obsnames] <- log10(df[x@unit_obsnames]+1) g <- ggplot2::ggplot(data = df, mapping = ggplot2::aes(x = !!rlang::sym(x@timename), y = factor(!!rlang::sym(x@unitname), @@ -104,3 +84,22 @@ setMethod( } } ) + +##' @name plot-igirfd_spatPomp +##' @rdname plot +##' @aliases plot,igirfd_spatPomp-method +setMethod( + "plot", + signature=signature(x="igirfd_spatPomp"), + definition=function (x, params = names(coef(x)), ncol = 3) { + plot.df <- data.frame(x@traces[,c("loglik", params)]) + cn <- colnames(plot.df) + plot.df <- cbind(c(seq_len(dim(plot.df)[1])), plot.df) + names(plot.df) <- c("iteration", cn) + to.gather <- colnames(plot.df)[2:length(colnames(plot.df))] + to.plot <- plot.df |> tidyr::gather(key = "param", val = "value", tidyr::all_of(to.gather)) |> tail(-1) + ggplot2::ggplot(data = to.plot) + + ggplot2::geom_line(mapping = ggplot2::aes(x = .data$iteration, y = .data$value)) + + ggplot2::facet_wrap(~param, ncol = ncol, scales = "free") + } +) diff --git a/R/runit_measure.R b/R/runit_measure.R index 85c95ea..f96d157 100644 --- a/R/runit_measure.R +++ b/R/runit_measure.R @@ -1,4 +1,4 @@ -#' runit_measure +#' Random draw from the measurement model for one unit #' #' \code{runit_measure} simulates a unit's observation given the entire state #' @name runit_measure diff --git a/R/spatPomp.R b/R/spatPomp.R index a27a22b..e19706f 100644 --- a/R/spatPomp.R +++ b/R/spatPomp.R @@ -93,7 +93,7 @@ spatPomp <- function (data, units, times, covar, t0, ..., rprocess, rmeasure, dprocess, dmeasure, skeleton, rinit, rprior, dprior, unit_statenames, unit_accumvars, shared_covarnames, globals, paramnames, params, cdir,cfile, shlib.args, PACKAGE, - partrans, compile=TRUE, verbose = getOption("verbose",FALSE)) { + partrans, compile=TRUE, verbose = getOption("spatPomp_verbose",FALSE)) { ep <- paste0("in ",sQuote("spatPomp"),": ") diff --git a/R/vec_dmeasure.R b/R/vec_dmeasure.R index 9733ba1..e28be18 100644 --- a/R/vec_dmeasure.R +++ b/R/vec_dmeasure.R @@ -1,4 +1,4 @@ -##' Vector of measurement densities +##' Vector of unit measurement densities for each unit ##' ##' Evaluate the unit measurement model density function for each unit. ##' This method is used primarily as part of likelihood evaluation and parameter inference algorithms. diff --git a/R/vec_rmeasure.R b/R/vec_rmeasure.R index d771b22..fb2265b 100644 --- a/R/vec_rmeasure.R +++ b/R/vec_rmeasure.R @@ -1,4 +1,4 @@ -##' Vector of simulated measurements +##' Vector simulating measurements for each unit using \code{runit_measure} ##' ##' Simulate from the unit measurement model density function for each unit ##' @param object a \code{spatPomp} object diff --git a/R/vunit_measure.R b/R/vunit_measure.R index 1b27a25..774d31d 100644 --- a/R/vunit_measure.R +++ b/R/vunit_measure.R @@ -1,4 +1,4 @@ -#' vunit_measure +#' Conditional variance of the measurement on a single unit #' #' \code{vunit_measure} evaluates the variance of a unit's observation given the entire state #' @name vunit_measure diff --git a/man/abf.Rd b/man/abf.Rd index f43a161..51b6ff3 100644 --- a/man/abf.Rd +++ b/man/abf.Rd @@ -16,10 +16,18 @@ params, tol = 1e-100, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) -\S4method{abf}{abfd_spatPomp}(object, Nrep, Np, nbhd, tol, ..., verbose = getOption("verbose", FALSE)) +\S4method{abf}{abfd_spatPomp}( + object, + Nrep, + Np, + nbhd, + tol, + ..., + verbose = getOption("spatPomp_verbose", FALSE) +) } \arguments{ \item{object}{A \code{spatPomp} object.} diff --git a/man/abfir.Rd b/man/abfir.Rd index 5a0fd92..884fce8 100644 --- a/man/abfir.Rd +++ b/man/abfir.Rd @@ -17,7 +17,7 @@ tol = (1e-100), params, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) \S4method{abfir}{abfird_spatPomp}(object, Np, Nrep, nbhd, Ninter, tol, params, ...) diff --git a/man/bpfilter.Rd b/man/bpfilter.Rd index ce2381f..3b31d35 100644 --- a/man/bpfilter.Rd +++ b/man/bpfilter.Rd @@ -24,7 +24,7 @@ save_states, filter_traj, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) \S4method{bpfilter}{bpfilterd_spatPomp}( @@ -35,7 +35,7 @@ save_states, filter_traj, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) } \arguments{ diff --git a/man/conc.Rd b/man/conc.Rd index c6a1057..fc84215 100644 --- a/man/conc.Rd +++ b/man/conc.Rd @@ -5,7 +5,7 @@ \alias{conc,SpatPomp-method} \alias{conc,Bpfilter-method} \alias{conc,Ibpf-method} -\title{Concatenate} +\title{Concatenate spatPomp objects into a listie} \usage{ \S4method{conc}{SpatPomp}(...) diff --git a/man/enkf.Rd b/man/enkf.Rd index 93e9916..8d8d270 100644 --- a/man/enkf.Rd +++ b/man/enkf.Rd @@ -8,7 +8,7 @@ \alias{enkf,spatPomp-method} \title{Generalized Ensemble Kalman filter (EnKF)} \usage{ -\S4method{enkf}{spatPomp}(data, Np, ..., verbose = getOption("verbose", FALSE)) +\S4method{enkf}{spatPomp}(data, Np, ..., verbose = getOption("spatPomp_verbose", FALSE)) } \arguments{ \item{data}{A \code{spatPomp} object.} diff --git a/man/eunit_measure.Rd b/man/eunit_measure.Rd index 0425c2a..43fd7cd 100644 --- a/man/eunit_measure.Rd +++ b/man/eunit_measure.Rd @@ -4,7 +4,7 @@ \alias{eunit_measure} \alias{eunit_measure-spatPomp} \alias{eunit_measure,spatPomp-method} -\title{eunit_measure} +\title{Expectation of the measurement model for one unit} \usage{ \S4method{eunit_measure}{spatPomp}(object, x, unit, time, params, Np = 1, log = FALSE) } diff --git a/man/girf.Rd b/man/girf.Rd index 080af7d..eb5f444 100644 --- a/man/girf.Rd +++ b/man/girf.Rd @@ -25,7 +25,7 @@ kind = c("bootstrap", "moment"), tol, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) \S4method{girf}{girfd_spatPomp}( diff --git a/man/ibpf.Rd b/man/ibpf.Rd index 275c37e..37ee54d 100644 --- a/man/ibpf.Rd +++ b/man/ibpf.Rd @@ -31,7 +31,7 @@ block_list, spat_regression, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) \S4method{ibpf}{ibpfd_spatPomp}( @@ -47,7 +47,7 @@ block_list, spat_regression, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) \S4method{ibpf}{bpfilterd_spatPomp}( @@ -63,7 +63,7 @@ block_list, spat_regression, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) } \arguments{ diff --git a/man/ienkf.Rd b/man/ienkf.Rd index 3dd81f4..f6f1b0f 100644 --- a/man/ienkf.Rd +++ b/man/ienkf.Rd @@ -14,7 +14,7 @@ cooling.fraction.50, Np, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) } \arguments{ diff --git a/man/igirf.Rd b/man/igirf.Rd index 9155852..8bd025d 100644 --- a/man/igirf.Rd +++ b/man/igirf.Rd @@ -29,7 +29,7 @@ kind = c("bootstrap", "moment"), tol = 1e-100, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) \S4method{igirf}{igirfd_spatPomp}( @@ -45,7 +45,7 @@ kind = c("bootstrap", "moment"), tol, ..., - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) } \arguments{ diff --git a/man/iubf.Rd b/man/iubf.Rd index 98153f9..61c2d66 100644 --- a/man/iubf.Rd +++ b/man/iubf.Rd @@ -17,7 +17,7 @@ cooling.type = c("geometric", "hyperbolic"), cooling.fraction.50, tol = (1e-18)^17, - verbose = getOption("verbose"), + verbose = getOption("spatPomp_verbose"), ... ) } diff --git a/man/listie.Rd b/man/listie.Rd index 228a9db..6e94757 100644 --- a/man/listie.Rd +++ b/man/listie.Rd @@ -2,8 +2,9 @@ % Please edit documentation in R/listie.R \name{listie} \alias{listie} -\title{listie} +\title{listie: List-like objects} \description{ -List-like objects. +A listie allows object-oriented behavior on lists of +\sQuote{spatPomp} objects } \keyword{internal} diff --git a/man/loglik.Rd b/man/loglik.Rd index 2c8e3da..f9fc7ac 100644 --- a/man/loglik.Rd +++ b/man/loglik.Rd @@ -14,7 +14,7 @@ \alias{logLik,abfird_spatPomp-method} \alias{logLik-igirfd_spatPomp} \alias{logLik,igirfd_spatPomp-method} -\title{Log likelihood} +\title{Log likelihood extractor} \usage{ \S4method{logLik}{girfd_spatPomp}(object) @@ -35,5 +35,5 @@ a numeric which is the estimated log likelihood } \description{ -Extract the estimated log likelihood. +Extracts the estimated log likelihood from a fitted model } diff --git a/man/lorenz.Rd b/man/lorenz.Rd index 1f4e2dc..451dfab 100644 --- a/man/lorenz.Rd +++ b/man/lorenz.Rd @@ -3,7 +3,7 @@ \name{lorenz} \alias{lorenz} \alias{lorenz96} -\title{Lorenz '96 spatPomp simulator} +\title{Lorenz '96 spatPomp constructor} \usage{ lorenz( U = 5, diff --git a/man/munit_measure.Rd b/man/munit_measure.Rd index 93bf104..63af6ee 100644 --- a/man/munit_measure.Rd +++ b/man/munit_measure.Rd @@ -4,7 +4,7 @@ \alias{munit_measure} \alias{munit_measure-spatPomp} \alias{munit_measure,spatPomp-method} -\title{munit_measure} +\title{Matching moments for the unit measurement model} \usage{ \S4method{munit_measure}{spatPomp}(object, x, vc, unit, time, params, Np = 1) } diff --git a/man/plot.Rd b/man/plot.Rd index 705ccce..925e2fb 100644 --- a/man/plot.Rd +++ b/man/plot.Rd @@ -2,28 +2,24 @@ % Please edit documentation in R/plot.R \name{plot} \alias{plot} -\alias{plot-igirfd_spatPomp} -\alias{plot,igirfd_spatPomp-method} \alias{plot-spatPomp} \alias{plot,spatPomp-method} -\title{Plotting \code{spatPomp} data} +\alias{plot-igirfd_spatPomp} +\alias{plot,igirfd_spatPomp-method} +\title{Plot methods for \code{spatPomp} objects} \usage{ -\S4method{plot}{igirfd_spatPomp}(x, params = names(coef(x)), ncol = 3) +\S4method{plot}{spatPomp}(x, type = c("l", "h"), log = FALSE, plot_unit_names = TRUE, ...) -\S4method{plot}{spatPomp}(x, type = c("l", "h"), log = F, plot_unit_names = T, ...) +\S4method{plot}{igirfd_spatPomp}(x, params = names(coef(x)), ncol = 3) } \arguments{ \item{x}{a \code{spatPomp} object} -\item{params}{the names of the parameters for which the user would like to see a trace plot} - -\item{ncol}{the number of columns in the grid plot} - \item{type}{for visualizing an object of class \code{spatPomp}, the user -can obtain a grid of line plots by default (\code{'l'}) or a heat map by -supplying argument \code{'h'}.} +can obtain a grid of line plots by default (\code{l}) or a heat map by +supplying argument \code{h}.} -\item{log}{should the data be log-transformed before plotting? +\item{log}{should the data be transformed to \code{log10(x+1)} before plotting? This helps in contexts where there are spikes that could take away attention from the dynamics illustrated by the rest of the data.} @@ -33,18 +29,17 @@ a heat map for a large number of units} \item{...}{for visualizing an object of class \code{spatPomp}, the user can add arguments like \code{nrow} to specify the number of rows in the grid.} + +\item{params}{allows selection of a subset of parameters when making +a diagnostic plot for a model with many parameters} + +\item{ncol}{the number of columns in the grid plot} } \value{ -a \code{ggplot} facet plot of class \sQuote{gg} and \sQuote{ggplot} visualizing -the convergence record of running \code{igirf()} with respect to the likelihood and the parameters of the model. - -a \code{ggplot} plot of class \sQuote{gg} and \sQuote{ggplot} visualizing -the time series data over multiple spatial units via a tile-plot. +a \code{ggplot} plot of class \sQuote{gg} and \sQuote{ggplot}. } \description{ -Visualize \code{spatPomp} data - -Diagnostic plot for \code{igirf()} - -Visualize \code{spatPomp} data +Visualize data in a \code{spatPomp} object or a derived class. +This gives a quick view; the data can be extracted from +the object to make a customized plot. } diff --git a/man/runit_measure.Rd b/man/runit_measure.Rd index 10c1aae..e68e1c1 100644 --- a/man/runit_measure.Rd +++ b/man/runit_measure.Rd @@ -4,7 +4,7 @@ \alias{runit_measure} \alias{runit_measure-spatPomp} \alias{runit_measure,spatPomp-method} -\title{runit_measure} +\title{Random draw from the measurement model for one unit} \usage{ \S4method{runit_measure}{spatPomp}(object, x, unit, time, params, log = FALSE) } diff --git a/man/spatPomp.Rd b/man/spatPomp.Rd index db5d1aa..18ad634 100644 --- a/man/spatPomp.Rd +++ b/man/spatPomp.Rd @@ -36,7 +36,7 @@ spatPomp( PACKAGE, partrans, compile = TRUE, - verbose = getOption("verbose", FALSE) + verbose = getOption("spatPomp_verbose", FALSE) ) } \arguments{ diff --git a/man/vec_dmeasure.Rd b/man/vec_dmeasure.Rd index b0ea0af..6957d26 100644 --- a/man/vec_dmeasure.Rd +++ b/man/vec_dmeasure.Rd @@ -4,7 +4,7 @@ \alias{vec_dmeasure} \alias{vec_dmeasure-spatPomp} \alias{vec_dmeasure,spatPomp-method} -\title{Vector of measurement densities} +\title{Vector of unit measurement densities for each unit} \usage{ \S4method{vec_dmeasure}{spatPomp}(object, y, x, units, times, params, log = FALSE, ...) } diff --git a/man/vec_rmeasure.Rd b/man/vec_rmeasure.Rd index 5b74108..3f8db65 100644 --- a/man/vec_rmeasure.Rd +++ b/man/vec_rmeasure.Rd @@ -4,7 +4,7 @@ \alias{vec_rmeasure} \alias{vec_rmeasure-spatPomp} \alias{vec_rmeasure,spatPomp-method} -\title{Vector of simulated measurements} +\title{Vector simulating measurements for each unit using \code{runit_measure}} \usage{ \S4method{vec_rmeasure}{spatPomp}(object, x, times, params, ...) } diff --git a/man/vunit_measure.Rd b/man/vunit_measure.Rd index 1b71040..1c5e581 100644 --- a/man/vunit_measure.Rd +++ b/man/vunit_measure.Rd @@ -4,7 +4,7 @@ \alias{vunit_measure} \alias{vunit_measure-spatPomp} \alias{vunit_measure,spatPomp-method} -\title{vunit_measure} +\title{Conditional variance of the measurement on a single unit} \usage{ \S4method{vunit_measure}{spatPomp}(object, x, unit, time, params, Np = 1) }