Package: nimble 1.2.1

Christopher Paciorek

nimble: MCMC, Particle Filtering, and Programmable Hierarchical Modeling

A system for writing hierarchical statistical models largely compatible with 'BUGS' and 'JAGS', writing nimbleFunctions to operate models and do basic R-style math, and compiling both models and nimbleFunctions via custom-generated C++. 'NIMBLE' includes default methods for MCMC, Laplace Approximation, Monte Carlo Expectation Maximization, and some other tools. The nimbleFunction system makes it easy to do things like implement new MCMC samplers from R, customize the assignment of samplers to different parts of a model from R, and compile the new samplers automatically via C++ alongside the samplers 'NIMBLE' provides. 'NIMBLE' extends the 'BUGS'/'JAGS' language by making it extensible: New distributions and functions can be added, including as calls to external compiled code. Although most people think of MCMC as the main goal of the 'BUGS'/'JAGS' language for writing models, one can use 'NIMBLE' for writing arbitrary other kinds of model-generic algorithms as well. A full User Manual is available at <https://r-nimble.org>.

Authors:Perry de Valpine [aut], Christopher Paciorek [aut, cre], Daniel Turek [aut], Nick Michaud [aut], Cliff Anderson-Bergman [aut], Fritz Obermeyer [aut], Claudia Wehrhahn Cortes [aut], Abel Rodríguez [aut], Duncan Temple Lang [aut], Wei Zhang [aut], Sally Paganin [aut], Joshua Hug [aut], Paul van Dam-Bates [aut], Jagadish Babu [ctb], Lauren Ponisio [ctb], Peter Sujan [ctb]

nimble_1.2.1.tar.gz
nimble_1.2.1.tar.gz(r-4.5-noble)nimble_1.2.1.tar.gz(r-4.4-noble)
nimble_1.2.1.tgz(r-4.4-emscripten)nimble_1.2.1.tgz(r-4.3-emscripten)
nimble.pdf |nimble.html
nimble/json (API)
NEWS

# Install 'nimble' in R:
install.packages('nimble', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/nimble-dev/nimble/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3

6.68 score 1 stars 18 packages 2.2k scripts 2.7k downloads 260 exports 15 dependencies

Last updated 4 months agofrom:65bec1b973. Checks:OK: 2. Indexed: no.

TargetResultDate
Doc / VignettesOKOct 30 2024
R-4.5-linux-x86_64OKOct 30 2024

Exports:ADbreakADNimbleListADproxyModelClassAGHQuad_paramsAGHQuad_summaryany_naany_nanas.carAdjacencyas.carCMasColasRowautoBlockbuildAGHQbuildAuxiliaryFilterbuildBootstrapFilterbuildEnsembleKFbuildIteratedFilter2buildLaplacebuildLiuWestFilterbuildMCEMbuildMCMCcalc_dcatConjugacyContributionscalc_dmnormAltParamscalc_dmnormConjugacyContributionscalc_dwishAltParamscalcAdaptationFactorcalcNodescalcNodesMVcalculatecalculateDiffcalculateWAICCAR_calcCCAR_calcCmatrixCAR_calcEVs2CAR_calcEVs3CAR_calcMCAR_calcNumIslandscarBoundscarMaxBoundcarMinBoundcc_getNodesInExprcheckInterruptclearCompiledcloglogcompileNimbleconfigureMCMCconfigureRJcubedcar_normaldcar_properdcatdconstraintdCRPddexpddirchdecidedecideAndJumpdeclarederegisterDistributionsdexp_nimbledflatdhalfflatdintervaldinvgammadinvwish_choldlkj_corr_choleskydmnorm_choldmultidmvt_choldsqrtinvgammadt_nonstandarddwish_choleigenNimbleListexpitextractControlElementgetBoundgetBUGSexampleDirgetConditionallyIndependentSetsgetDefinitiongetDimensiongetDistributionInfogetLogProbgetLogProbNodesgetLogProbNodesMVgetMacroParametersgetNimbleOptiongetNimbleProjectgetNodeFunctionIndexedInfogetParamgetParamNamesgetSamplesDPmeasuregetsizegetTypeicloglogidentityMatrixilogitinitializeModelinprodinverseiprobitis.Cmodelis.Cnfis.modelis.nfis.nfGeneratoris.nlis.RmodelisDiscreteisUserDefinedlogdetlogfactloggamlogitmakeBoundInfomakeModelDerivsInfomakeParamInfoMCEM_mcsemcmc_createModelObjectmessageIfVerbosemodel_macro_buildermodelValuesmodelValuesConfnf_preProcessMemberDataObjectnfMethodnfVarnfVar<-nimArraynimbleCodenimbleExternalCallnimbleFunctionnimbleFunctionListnimbleFunctionVirtualnimbleInternalFunctionsnimbleListnimbleMCMCnimbleModelnimbleOptionsnimbleRcallnimbleTypenimbleUserNamespacenimCnimCatnimCopynimDerivsnimDimnimEigennimEqualsnimIntegernimIntegratenimLogicalnimMatrixnimNumericnimOptimnimOptimDefaultControlnimOptimMethodnimPrintnimRepnimRoundnimSeqnimStepnimStopnimSvdnimSwitchoptimControlNimbleListoptimDefaultControloptimResultNimbleListparameterTransformpdexppexp_nimblephipinvgammapowpow_intpqDefinedprintErrorsprobitpt_nonstandardqdexpqexp_nimbleqinvgammaqt_nonstandardrankSamplercar_normalrcar_properrcatrconstraintrCRPrdexprdirchreadBUGSmodelregisterDistributionsresizerexp_nimblerflatrhalfflatrintervalrinvgammarinvwish_cholrlkj_corr_choleskyRmatrix2mvOneVarrmnorm_cholrmultirmvt_cholrsqrtinvgammart_nonstandardrun.timerunAGHQrunCrossValidaterunLaplacerunMCMCrwish_cholsampler_AF_slicesampler_BASEsampler_binarysampler_CAR_normalsampler_CAR_propersampler_categoricalsampler_crossLevelsampler_CRPsampler_CRP_concentrationsampler_esssampler_noncenteredsampler_polyagammasampler_posterior_predictivesampler_prior_samplessampler_RJ_fixed_priorsampler_RJ_indicatorsampler_RJ_toggledsampler_RWsampler_RW_blocksampler_RW_block_lkj_corr_choleskysampler_RW_dirichletsampler_RW_lkj_corr_choleskysampler_RW_llFunctionsampler_RW_llFunction_blocksampler_RW_multinomialsampler_RW_wishartsampler_slicesampler_slice_CRP_base_paramsamplesSummarysetAndCalculatesetAndCalculateDiffsetAndCalculateOnesetSizesetupMargNodessimNodessimNodesMVsimulatesingleModelValuesAccessstick_breakingsummaryAGHQsummaryLaplacesvdNimbleListtestBUGSmodelvalueInCompiledNimbleFunctionvaluesvalues<-waicDetailsNimbleListwaicNimbleListwithNimbleOptions

Dependencies:clicodacpp11glueigraphlatticelifecyclemagrittrMatrixnumDerivpkgconfigpracmaR6rlangvctrs

Readme and manuals

Help Manual

Help pageTopics
NIMBLE language function to break tracking of derivativesADbreak
Data type for the return value of 'nimDerivs'ADNimbleList
create an ADproxyModelClass objectADproxyModelClass ADproxyModelClass-class
Determine if any values in a vector are NA or NaNany_na any_nan
Convert CAR structural parameters to adjacency, weights, num formatas.carAdjacency
Convert weights vector to parameters of 'dcar_proper' distributioas.carCM
Turn a numeric vector into a single-row or single-column matrixasCol asRow
Automated parameter blocking procedure for efficient MCMC samplingautoBlock
BUGSdeclClass contains the information extracted from one BUGS declarationBUGSdeclClass BUGSdeclClass-class
Build Adaptive Gauss-Hermite Quadrature GridbuildAGHQGrid
Placeholder for buildAuxiliaryFilterbuildAuxiliaryFilter
Placeholder for buildBootstrapFilterbuildBootstrapFilter
Placeholder for buildEnsembleKFbuildEnsembleKF
Placeholder for buildIteratedFilter2buildIteratedFilter2
Laplace approximation and adaptive Gauss-Hermite quadratureAGHQ AGHQuad buildAGHQ buildLaplace Laplace laplace
Placeholder for buildLiuWestFilterbuildLiuWestFilter
Builds an MCEM algorithm for a given NIMBLE modelbuildMCEM
Create an MCMC object from a NIMBLE model, or an MCMC configuration objectbuildMCMC
Calculating WAIC using an offline algorithmcalculateWAIC
Calculate number of islands based on a CAR adjacency matrix.CAR_calcNumIslands
The CAR-Normal DistributionCAR-Normal dcar_normal rcar_normal
The CAR-Proper DistributionCAR-Proper dcar_proper rcar_proper
Calculate bounds for the autocorrelation parameter of the 'dcar_proper' distributioncarBounds
Calculate the upper bound for the autocorrelation parameter of the 'dcar_proper' distributioncarMaxBound
Calculate the lower bound for the autocorrelation parameter of the 'dcar_proper' distributioncarMinBound
The Categorical DistributionCategorical dcat rcat
Check for interrupt (e.g. Ctrl-C) during nimbleFunction execution. Part of the NIMBLE language.checkInterrupt
The Chinese Restaurant Process DistributionChineseRestaurantProcess dCRP rCRP
Clear compiled objects from a project and unload shared libraryclearCompiled
Class 'CmodelBaseClass'CmodelBaseClass CmodelBaseClass-class
Class 'CnimbleFunctionBase'CnimbleFunctionBase CnimbleFunctionBase-class
Class 'codeBlockClass'codeBlockClass codeBlockClass-class
compile NIMBLE models and nimbleFunctionscompileNimble
Build the MCMCconf object for construction of an MCMC objectconfigureMCMC
Configure Reversible Jump for Variable SelectionconfigureRJ
Constraint calculations in NIMBLEConstraint dconstraint rconstraint
Makes the Metropolis-Hastings acceptance decision, based upon the input (log) Metropolis-Hastings ratiodecide
Creates a nimbleFunction for executing the Metropolis-Hastings jumping decision, and updating values in the model, or in a carbon copy modelValues object, accordingly.decideAndJump
Explicitly declare a variable in run-time code of a nimbleFunctiondeclare
Remove user-supplied distributions from use in NIMBLE BUGS modelsderegisterDistributions
The Dirichlet Distributionddirch Dirichlet dirichlet rdirch
Get information about a distributiondistributionInfo getDistributionInfo getParamNames getType isUserDefined pqDefined
The Double Exponential (Laplace) Distributionddexp Double-Exponential pdexp qdexp rdexp
eigenNimbleList definitioneigenNimbleList
The Exponential Distributiondexp_nimble Exponential pexp_nimble qexp_nimble rexp_nimble
Extract named elements from MCMC sampler control listextractControlElement
The Improper Uniform Distributiondflat dhalfflat flat halfflat rflat rhalfflat
Get value of bound of a stochastic node in a modelgetBound
Get the directory path to one of the classic BUGS examples installed with NIMBLE packagegetBUGSexampleDir
Get a list of conditionally independent sets of nodes in a nimble modelgetConditionallyIndependentSets
Get nimbleFunction definitiongetDefinition
EXPERIMENTAL: Get list of parameter names generated by model macrosgetMacroParameters
Get NIMBLE OptiongetNimbleOption
Get value of a parameter of a stochastic node in a modelgetParam
Get posterior samples for a Dirichlet process measuregetSamplesDPmeasure
Returns number of rows of modelValuesgetsize
Create an Identity matrix (Deprecated)identityMatrix
Performs initialization of nimble model node values and log probabilitiesinitializeModel
Interval calculationsdinterval Interval rinterval
The Inverse Gamma Distributiondinvgamma Inverse-Gamma pinvgamma qinvgamma rinvgamma
The Inverse Wishart Distributiondinvwish_chol Inverse-Wishart inverse-wishart rinvwish_chol
check if a nimbleFunctionis.nf
check if a nimbleListis.nl
The LKJ Distribution for the Cholesky Factor of a Correlation Matrixdlkj dlkj_corr_cholesky LKJ lkj lkj_corr lkj_corr_cholesky rlkj rlkj_corr_cholesky
Make an object of information about a model-bound pairing for getBound. Used internallymakeBoundInfo
Information on model structure used for derivativesmakeModelDerivsInfo
Make an object of information about a model-parameter pairing for getParam. Used internallymakeParamInfo
Class 'MCMCconf'addMonitors addMonitors2 addSampler getMonitors getMonitors2 getSamplerExecutionOrder getSamplers MCMCconf MCMCconf-class printMonitors printSamplers removeSamplers resetMonitors setMonitors setMonitors2 setSamplerExecutionOrder setSamplers setThin setThin2
EXPERIMENTAL: Turn a function into a model macromodel_macro_builder
Class 'modelBaseClass'checkConjugacy expandNodeNames getCode getConstants getDependencies getDependenciesList getDimension getDistribution getDownstream getMacroInits getNodeNames getParents getVarNames initializeInfo isBinary isData isDeterm isDiscrete isEndNode isMultivariate isStoch isTruncated isUnivariate modelBaseClass modelBaseClass-class newModel resetData setData setInits topologicallySortNodes [[,modelBaseClass-method [[<-,modelBaseClass-method
Class for NIMBLE model definitionmodelDefClass modelDefClass-class
Information on initial values in a NIMBLE modelmodelInitialization
Create a NIMBLE modelValues ObjectmodelValues
Class 'modelValuesBaseClass'modelValuesBaseClass modelValuesBaseClass-class [,CmodelValues-method [,CmodelValues-method,ANY,ANY [,CmodelValues-method,character,missing [,CmodelValues-method,character,missing,ANY-method [,modelValuesBaseClass-method [<-,CmodelValues-method [<-,modelValuesBaseClass-method [[,CmodelValues-method [[<-,CmodelValues-method
Create the confs for a custom NIMBLE modelValues objectmodelValuesConf
The Multinomial Distributiondmulti Multinomial multinomial rmulti
The Multivariate t Distributiondmvt_chol Multivariate-t multivariate-t mvt rmvt_chol
The Multivariate Normal Distributiondmnorm_chol MultivariateNormal rmnorm_chol
access (call) a member function of a nimbleFunctionnfMethod
Access or set a member variable of a nimbleFunctionnfVar nfVar<-
Functions and Classes Internal to NIMBLEAGHQuad_params AGHQuad_summary as.list.modelValuesBaseClass-Class as.matrix.modelValuesBaseClass-Class autoBlockClass-Class BUGScontextClass-Class BUGSsingleContextClass-Class calcAdaptationFactor calc_dcatConjugacyContributions calc_dmnormAltParams calc_dmnormConjugacyContributions calc_dwishAltParams CAR_calcC CAR_calcCmatrix CAR_calcEVs2 CAR_calcEVs3 CAR_calcM cc_getNodesInExpr CmultiNimbleFunctionClass-Class CmultiNimbleListClass-Class CmultiNimbleObjClass-Class conjugacyClass-Class conjugacyRelationshipsClass-Class copyExprClass-Class cppBUGSmodelClass-Class cppCodeFileClass-Class cppCPPfileClass-Class cppHfileClass-Class cppModelValuesClass-Class cppNamedObjectsClass-Class cppNimbleClassClass-Class cppNimbleFunctionClass-Class cppNimbleListClass-Class cppProjectClass-Class cppVirtualNimbleFunctionClass-Class dependentClass-Class distClass-Class distributionsClass-Class dsqrtinvgamma eigenize_nimbleNullaryClass-Class exprClass-Class exprTypeInfoClass-Class findClass-Class findMethodsInExprClass-Class getClass-Class getNimbleProject getNodeFunctionIndexedInfo getRefClass-Class indexedNodeInfoTableClass-Class is.Cmodel is.Cnf is.model is.nfGenerator is.Rmodel isClass-Class isSealedClass-Class isVirtualClass-Class isXS3Class-Class keywordInfoClass-Class MakeCustomModelClass-Class makeCustomModelValuesClass-Class mapsClass-Class MCEM_mcse mcmc_createModelObject messageIfVerbose modelDefInfoClass-Class mvInfoClass-Class nfCompilationInfoClass-Class nf_preProcessMemberDataObject nimbleGraphClass-Class nimbleInternalFunctions nimbleListDefClass-Class nimbleProjectClass-Class nimbleUserNamespace nimDerivsInfoClass-Class nlCompilationInfoClass-Class posteriorClass-Class promptClass-Class R6Class-Class RCfunctionCompileClass-Class RCfunInfoClass-Class removeClass-Class resetClass-Class RMakeCustomModelClass-Class rsqrtinvgamma S3Class-Class samplesSummary sealClass-Class setClass-Class setOldClass-Class setRefClass-Class setupCodeTemplateClass-Class showClass-Class singleModelValuesAccess singleModelValuesAccessClass-Class varInfoClass-Class [,distributionsClass-method [,numberedModelValuesAccessors-method [,numberedObjects-method [<-,numberedModelValuesAccessors-method [<-,numberedObjects-method [[,CNumericList-method [[,conjugacyRelationshipsClass-method [[,distributionsClass-method [[,nimPointerList-method [[,RNumericList-method [[<-,CNumericList-method [[<-,nimbleFunctionList-method [[<-,nimPointerList-method [[<-,RNumericList-method
Mathematical functions for BUGS and nimbleFunction programmingbesselK cloglog cube expit icloglog ilogit inprod inverse iprobit logdet logfact loggam logit nimEquals nimRound nimStep nimSwitch phi pow probit
NIMBLE language functions for R-like vector constructionall any c diag is.na is.nan length nimble-R-functions nimC nimRep nimSeq rep seq seq_along which
Turn BUGS model code into an object for use in 'nimbleModel' or 'readBUGSmodel'nimbleCode
Create a nimbleFunction that wraps a call to external compiled codenimbleExternalCall
create a nimbleFunctionnimbleFunction
Class 'nimbleFunctionBase'nimbleFunctionBase nimbleFunctionBase-class
Create a list of nimbleFunctionsnimbleFunctionList nimbleFunctionList-class
create a virtual nimbleFunction, a base class for other nimbleFunctionsnimbleFunctionVirtual
create a nimbleListnimbleList
Executes one or more chains of NIMBLE's default MCMC algorithm, for a model specified using BUGS codenimbleMCMC
Create a NIMBLE model from BUGS codenimbleModel
NIMBLE Options SettingsnimbleOptions
Make an R function callable from compiled nimbleFunctions (including nimbleModels).nimbleRcall
create a nimbleType objectnimbleType nimbleType-class
cat function for use in nimbleFunctionscat nimCat
Copying function for NIMBLEcopy nimCopy
Nimble DerivativesAD derivs nimDerivs
return sizes of an object whether it is a vector, matrix or arraydim nimDim
Spectral Decomposition of a Matrixeigen nimEigen
Integration of One-Dimensional Functionsintegrate nimIntegrate
Creates matrix or array objects for use in nimbleFunctionsarray matrix nimArray nimMatrix
Creates numeric, integer or logical vectors for use in nimbleFunctionsinteger logical nimInteger nimLogical nimNumeric numeric
General-purpose OptimizationnimOptim
Creates a default 'control' argument for 'nimOptim'.nimOptimDefaultControl
Set or get an optimization function to be used by 'nimOptim'nimOptimMethod
print function for use in nimbleFunctionsnimPrint print
Halt execution of a nimbleFunction function method. Part of the NIMBLE languagenimStop stop
Singular Value Decomposition of a MatrixnimSvd svd
calculate, calculateDiff, simulate, or get the current log probabilities (densities) a set of nodes in a NIMBLE modelcalculate calculateDiff getLogProb nodeFunctions simulate
Data type for the 'control' parameter of 'nimOptim'optimControlNimbleList
Creates a deafult 'control' argument for 'optim' (just an empty list).optimDefaultControl
Data type for the return value of 'nimOptim'optimResultNimbleList
Automated transformations of model nodes to unconstrained scalesparameterTransform
Power function for integer-valued exponentpow_int
Print error messages after failed compilationprintErrors
Generates a weighted sample (with replacement) of ranksrankSample
Create a NIMBLE BUGS model from a variety of input formats, including BUGS model filesreadBUGSmodel
Add user-supplied distributions for use in NIMBLE BUGS modelsregisterDistributions
Resizes a modelValues objectresize
Set values of one variable of a modelValues object from an R matrixRmatrix2mvOneVar
Class 'RmodelBaseClass'RmodelBaseClass RmodelBaseClass-class
Time execution of NIMBLE coderun.time
Perform k-fold cross-validation on a NIMBLE model fit by MCMCrunCrossValidate
Combine steps of running Laplace or adaptive Gauss-Hermite quadrature approximationrunAGHQ runLaplace
Run one or more chains of an MCMC algorithm and return samples, summary and/or WAICrunMCMC
MCMC Sampling AlgorithmsAF_slice binary categorical crossLevel CRP CRP_concentration DPmeasure posterior_predictive prior_samples RJ_fixed_prior RJ_indicator RJ_toggled RW RW_block RW_block_lkj_corr_cholesky RW_dirichlet RW_lkj_corr_cholesky RW_llFunction RW_llFunction_block RW_multinomial RW_PF RW_PF_block RW_wishart sampler samplers sampler_AF_slice sampler_BASE sampler_binary sampler_CAR_normal sampler_CAR_proper sampler_categorical sampler_crossLevel sampler_CRP sampler_CRP_concentration sampler_ess sampler_noncentered sampler_polyagamma sampler_posterior_predictive sampler_prior_samples sampler_RJ_fixed_prior sampler_RJ_indicator sampler_RJ_toggled sampler_RW sampler_RW_block sampler_RW_block_lkj_corr_cholesky sampler_RW_dirichlet sampler_RW_lkj_corr_cholesky sampler_RW_llFunction sampler_RW_llFunction_block sampler_RW_multinomial sampler_RW_wishart sampler_slice sampler_slice_CRP_base_param slice
Creates a nimbleFunction for setting the values of one or more model nodes, calculating the associated deterministic dependents and logProb values, and returning the total sum log-probability.setAndCalculate setAndCalculateDiff
Creates a nimbleFunction for setting the value of a scalar model node, calculating the associated deterministic dependents and logProb values, and returning the total sum log-probability.setAndCalculateOne
set the size of a numeric variable in NIMBLEsetSize
Organize model nodes for marginalizationsetupMargNodes
Explicitly declare objects created in setup code to be preserved and compiled as member datasetupOutputs
Basic nimbleFunctions for calculate, simulate, and getLogProb with a set of nodescalcNodes getLogProbNodes simNodes
Basic nimbleFunctions for using a NIMBLE model with sets of stored valuescalcNodesMV getLogProbNodesMV simNodesMV
Class 'singleVarAccessClass'singleVarAccessClass singleVarAccessClass-class
The Stick Breaking Functionstickbreaking StickBreakingFunction stick_breaking
Summarize results from Laplace or adaptive Gauss-Hermite quadrature approximationsummaryAGHQ summaryLaplace
svdNimbleList definitionsvdNimbleList
The t Distributiondt_nonstandard pt_nonstandard qt_nonstandard rt_nonstandard t
Tests BUGS examples in the NIMBLE systemtestBUGSmodel
get or set value of member data from a compiled nimbleFunction using a multi-interfacevalueInCompiledNimbleFunction
Access or set values for a set of nodes in a modelvalues values<-
Using WAICbuildWAIC enableWAIC getWAIC getWAICdetails WAIC waic
waicDetailsNimbleList definitionwaicDetailsNimbleList
waicNimbleList definitionwaicNimbleList
The Wishart Distributiondwish_chol rwish_chol Wishart wishart
Temporarily set some NIMBLE options.withNimbleOptions