@@ -739,70 +739,78 @@ Some additional comments are provided within this skeleton for a derived quantit
739739``` {r, eval=FALSE}
740740derived_name <- nimbleFunction(
741741 name = 'derived_name',
742- contains = derived_BASE, ## All derived functions must contain (inherit from) the `derived_BASE` class.
742+ ## All derived functions must contain (inherit from) the `derived_BASE` class.
743+ contains = derived_BASE,
743744 setup = function(model, mcmc, interval, control) {
744- ##
745- ## setup function must have these arguments, and has unrestricted access to:
746- ## - model
747- ## - mcmc
748- ## - interval (the MCMC sampling interval on which the run function will be executed)
749- ## - control (list of control arguments provided to this function)
750- ##
751- ## One can extract elements from `control` like this:
752- ## nodes <- extractControlElement(control, 'nodes', defaultValue = character())
745+ ##
746+ ## setup function must have these arguments, and has unrestricted access to:
747+ ## - model
748+ ## - mcmc
749+ ## - interval (the MCMC sampling interval on which the run function will
750+ ## be executed)
751+ ## - control (list of control arguments provided to this function)
752+ ##
753+ ## One can extract elements from `control` like this:
754+ ## nodes <- extractControlElement(control, 'nodes',
755+ ## defaultValue = character())
753756 },
754757 run = function(timesRan = double()) {
755- ##
756- ## run fuction has one argument:
757- ## timesRan, which is the number of times this method has executed during the present MCMC chain,
758- ## including the present time. This can be used as an index for a matrix of results.
759- ##
758+ ##
759+ ## run fuction has one argument:
760+ ## timesRan, which is the number of times this method has executed during
761+ ## the present MCMC chain,
762+ ## including the present time. This can be used as an index for a matrix
763+ ## of results.
764+ ##
760765 },
761766 methods = list(
762767 set_interval = function(newInterval = double()) {
763- ##
764- ## REQUIRED `set_interval` method, which matches the definition below exactly.
765- ## this method is necessary, to allow the default value of 'interval' to
766- ## match the thinning interval of the MCMC.
767- ##
768- interval <<- newInterval
769- ##
768+ ##
769+ ## REQUIRED `set_interval` method, which matches the definition below
770+ ## exactly.
771+ ## this method is necessary, to allow the default value of 'interval' to
772+ ## match the thinning interval of the MCMC.
773+ ##
774+ interval <<- newInterval
775+ ##
770776 },
771- before_chain = function(niter = double(), nburnin = double(), thin = double(1), chain = double()) {
772- ##
773- ## (optional) `before_chain` method,
774- ## must have must have these arguments specifications:
775- ## - niter (total number of *post-burnin* MCMC iterations)
776- ## - nburnin (number of burnin iterations for this MCMC chain)
777- ## - thin (a length=2 vector, containing the thinning intervals for mvSamples and mvSamples2)
778- ## - chain (the chain number of the current MCMC chain being run)
779- ##
777+ before_chain = function(niter = double(), nburnin = double(),
778+ thin = double(1), chain = double()) {
779+ ##
780+ ## (optional) `before_chain` method,
781+ ## must have must have these arguments specifications:
782+ ## - niter (total number of *post-burnin* MCMC iterations)
783+ ## - nburnin (number of burnin iterations for this MCMC chain)
784+ ## - thin (a length=2 vector, containing the thinning intervals for
785+ ## mvSamples and mvSamples2)
786+ ## - chain (the chain number of the current MCMC chain being run)
787+ ##
780788 },
781789 after_chain = function() {
782- ##
783- ## (optional) `after_chain` method,
784- ## no arguments and no return value
785- ##
790+ ##
791+ ## (optional) `after_chain` method,
792+ ## no arguments and no return value
793+ ##
786794 },
787795 get_results = function() {
788- ##
789- ## REQUIRED `get_results` method,
790- ## which must return a dim=2 numeric array
791- ##
792- returnType(double(2))
796+ ##
797+ ## REQUIRED `get_results` method,
798+ ## which must return a dim=2 numeric array
799+ ##
800+ returnType(double(2))
793801 },
794802 get_names = function() {
795- ##
796- ## REQUIRED `get_names` method,
797- ## which must return a dim=1 character vector
798- ##
799- returnType(character(1))
803+ ##
804+ ## REQUIRED `get_names` method,
805+ ## which must return a dim=1 character vector
806+ ##
807+ returnType(character(1))
800808 },
801809 reset = function() {
802- ##
803- ## (optional) `reset` method
804- ## no arguments and no return value
805- ##
810+ ##
811+ ## (optional) `reset` method
812+ ## no arguments and no return value
813+ ##
806814 }
807815 )
808816)
0 commit comments