Package: nimble 1.2.1
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:
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')) |
Bug tracker:https://github.com/nimble-dev/nimble/issues
Last updated 4 months agofrom:65bec1b973. Checks:OK: 2. Indexed: no.
Target | Result | Date |
---|---|---|
Doc / Vignettes | OK | Oct 30 2024 |
R-4.5-linux-x86_64 | OK | Oct 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 page | Topics |
---|---|
NIMBLE language function to break tracking of derivatives | ADbreak |
Data type for the return value of 'nimDerivs' | ADNimbleList |
create an ADproxyModelClass object | ADproxyModelClass ADproxyModelClass-class |
Determine if any values in a vector are NA or NaN | any_na any_nan |
Convert CAR structural parameters to adjacency, weights, num format | as.carAdjacency |
Convert weights vector to parameters of 'dcar_proper' distributio | as.carCM |
Turn a numeric vector into a single-row or single-column matrix | asCol asRow |
Automated parameter blocking procedure for efficient MCMC sampling | autoBlock |
BUGSdeclClass contains the information extracted from one BUGS declaration | BUGSdeclClass BUGSdeclClass-class |
Build Adaptive Gauss-Hermite Quadrature Grid | buildAGHQGrid |
Placeholder for buildAuxiliaryFilter | buildAuxiliaryFilter |
Placeholder for buildBootstrapFilter | buildBootstrapFilter |
Placeholder for buildEnsembleKF | buildEnsembleKF |
Placeholder for buildIteratedFilter2 | buildIteratedFilter2 |
Laplace approximation and adaptive Gauss-Hermite quadrature | AGHQ AGHQuad buildAGHQ buildLaplace Laplace laplace |
Placeholder for buildLiuWestFilter | buildLiuWestFilter |
Builds an MCEM algorithm for a given NIMBLE model | buildMCEM |
Create an MCMC object from a NIMBLE model, or an MCMC configuration object | buildMCMC |
Calculating WAIC using an offline algorithm | calculateWAIC |
Calculate number of islands based on a CAR adjacency matrix. | CAR_calcNumIslands |
The CAR-Normal Distribution | CAR-Normal dcar_normal rcar_normal |
The CAR-Proper Distribution | CAR-Proper dcar_proper rcar_proper |
Calculate bounds for the autocorrelation parameter of the 'dcar_proper' distribution | carBounds |
Calculate the upper bound for the autocorrelation parameter of the 'dcar_proper' distribution | carMaxBound |
Calculate the lower bound for the autocorrelation parameter of the 'dcar_proper' distribution | carMinBound |
The Categorical Distribution | Categorical dcat rcat |
Check for interrupt (e.g. Ctrl-C) during nimbleFunction execution. Part of the NIMBLE language. | checkInterrupt |
The Chinese Restaurant Process Distribution | ChineseRestaurantProcess dCRP rCRP |
Clear compiled objects from a project and unload shared library | clearCompiled |
Class 'CmodelBaseClass' | CmodelBaseClass CmodelBaseClass-class |
Class 'CnimbleFunctionBase' | CnimbleFunctionBase CnimbleFunctionBase-class |
Class 'codeBlockClass' | codeBlockClass codeBlockClass-class |
compile NIMBLE models and nimbleFunctions | compileNimble |
Build the MCMCconf object for construction of an MCMC object | configureMCMC |
Configure Reversible Jump for Variable Selection | configureRJ |
Constraint calculations in NIMBLE | Constraint dconstraint rconstraint |
Makes the Metropolis-Hastings acceptance decision, based upon the input (log) Metropolis-Hastings ratio | decide |
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 nimbleFunction | declare |
Remove user-supplied distributions from use in NIMBLE BUGS models | deregisterDistributions |
The Dirichlet Distribution | ddirch Dirichlet dirichlet rdirch |
Get information about a distribution | distributionInfo getDistributionInfo getParamNames getType isUserDefined pqDefined |
The Double Exponential (Laplace) Distribution | ddexp Double-Exponential pdexp qdexp rdexp |
eigenNimbleList definition | eigenNimbleList |
The Exponential Distribution | dexp_nimble Exponential pexp_nimble qexp_nimble rexp_nimble |
Extract named elements from MCMC sampler control list | extractControlElement |
The Improper Uniform Distribution | dflat dhalfflat flat halfflat rflat rhalfflat |
Get value of bound of a stochastic node in a model | getBound |
Get the directory path to one of the classic BUGS examples installed with NIMBLE package | getBUGSexampleDir |
Get a list of conditionally independent sets of nodes in a nimble model | getConditionallyIndependentSets |
Get nimbleFunction definition | getDefinition |
EXPERIMENTAL: Get list of parameter names generated by model macros | getMacroParameters |
Get NIMBLE Option | getNimbleOption |
Get value of a parameter of a stochastic node in a model | getParam |
Get posterior samples for a Dirichlet process measure | getSamplesDPmeasure |
Returns number of rows of modelValues | getsize |
Create an Identity matrix (Deprecated) | identityMatrix |
Performs initialization of nimble model node values and log probabilities | initializeModel |
Interval calculations | dinterval Interval rinterval |
The Inverse Gamma Distribution | dinvgamma Inverse-Gamma pinvgamma qinvgamma rinvgamma |
The Inverse Wishart Distribution | dinvwish_chol Inverse-Wishart inverse-wishart rinvwish_chol |
check if a nimbleFunction | is.nf |
check if a nimbleList | is.nl |
The LKJ Distribution for the Cholesky Factor of a Correlation Matrix | dlkj 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 internally | makeBoundInfo |
Information on model structure used for derivatives | makeModelDerivsInfo |
Make an object of information about a model-parameter pairing for getParam. Used internally | makeParamInfo |
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 macro | model_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 definition | modelDefClass modelDefClass-class |
Information on initial values in a NIMBLE model | modelInitialization |
Create a NIMBLE modelValues Object | modelValues |
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 object | modelValuesConf |
The Multinomial Distribution | dmulti Multinomial multinomial rmulti |
The Multivariate t Distribution | dmvt_chol Multivariate-t multivariate-t mvt rmvt_chol |
The Multivariate Normal Distribution | dmnorm_chol MultivariateNormal rmnorm_chol |
access (call) a member function of a nimbleFunction | nfMethod |
Access or set a member variable of a nimbleFunction | nfVar nfVar<- |
Functions and Classes Internal to NIMBLE | AGHQuad_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 programming | besselK 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 construction | all 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 code | nimbleExternalCall |
create a nimbleFunction | nimbleFunction |
Class 'nimbleFunctionBase' | nimbleFunctionBase nimbleFunctionBase-class |
Create a list of nimbleFunctions | nimbleFunctionList nimbleFunctionList-class |
create a virtual nimbleFunction, a base class for other nimbleFunctions | nimbleFunctionVirtual |
create a nimbleList | nimbleList |
Executes one or more chains of NIMBLE's default MCMC algorithm, for a model specified using BUGS code | nimbleMCMC |
Create a NIMBLE model from BUGS code | nimbleModel |
NIMBLE Options Settings | nimbleOptions |
Make an R function callable from compiled nimbleFunctions (including nimbleModels). | nimbleRcall |
create a nimbleType object | nimbleType nimbleType-class |
cat function for use in nimbleFunctions | cat nimCat |
Copying function for NIMBLE | copy nimCopy |
Nimble Derivatives | AD derivs nimDerivs |
return sizes of an object whether it is a vector, matrix or array | dim nimDim |
Spectral Decomposition of a Matrix | eigen nimEigen |
Integration of One-Dimensional Functions | integrate nimIntegrate |
Creates matrix or array objects for use in nimbleFunctions | array matrix nimArray nimMatrix |
Creates numeric, integer or logical vectors for use in nimbleFunctions | integer logical nimInteger nimLogical nimNumeric numeric |
General-purpose Optimization | nimOptim |
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 nimbleFunctions | nimPrint print |
Halt execution of a nimbleFunction function method. Part of the NIMBLE language | nimStop stop |
Singular Value Decomposition of a Matrix | nimSvd svd |
calculate, calculateDiff, simulate, or get the current log probabilities (densities) a set of nodes in a NIMBLE model | calculate 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 scales | parameterTransform |
Power function for integer-valued exponent | pow_int |
Print error messages after failed compilation | printErrors |
Generates a weighted sample (with replacement) of ranks | rankSample |
Create a NIMBLE BUGS model from a variety of input formats, including BUGS model files | readBUGSmodel |
Add user-supplied distributions for use in NIMBLE BUGS models | registerDistributions |
Resizes a modelValues object | resize |
Set values of one variable of a modelValues object from an R matrix | Rmatrix2mvOneVar |
Class 'RmodelBaseClass' | RmodelBaseClass RmodelBaseClass-class |
Time execution of NIMBLE code | run.time |
Perform k-fold cross-validation on a NIMBLE model fit by MCMC | runCrossValidate |
Combine steps of running Laplace or adaptive Gauss-Hermite quadrature approximation | runAGHQ runLaplace |
Run one or more chains of an MCMC algorithm and return samples, summary and/or WAIC | runMCMC |
MCMC Sampling Algorithms | AF_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 NIMBLE | setSize |
Organize model nodes for marginalization | setupMargNodes |
Explicitly declare objects created in setup code to be preserved and compiled as member data | setupOutputs |
Basic nimbleFunctions for calculate, simulate, and getLogProb with a set of nodes | calcNodes getLogProbNodes simNodes |
Basic nimbleFunctions for using a NIMBLE model with sets of stored values | calcNodesMV getLogProbNodesMV simNodesMV |
Class 'singleVarAccessClass' | singleVarAccessClass singleVarAccessClass-class |
The Stick Breaking Function | stickbreaking StickBreakingFunction stick_breaking |
Summarize results from Laplace or adaptive Gauss-Hermite quadrature approximation | summaryAGHQ summaryLaplace |
svdNimbleList definition | svdNimbleList |
The t Distribution | dt_nonstandard pt_nonstandard qt_nonstandard rt_nonstandard t |
Tests BUGS examples in the NIMBLE system | testBUGSmodel |
get or set value of member data from a compiled nimbleFunction using a multi-interface | valueInCompiledNimbleFunction |
Access or set values for a set of nodes in a model | values values<- |
Using WAIC | buildWAIC enableWAIC getWAIC getWAICdetails WAIC waic |
waicDetailsNimbleList definition | waicDetailsNimbleList |
waicNimbleList definition | waicNimbleList |
The Wishart Distribution | dwish_chol rwish_chol Wishart wishart |
Temporarily set some NIMBLE options. | withNimbleOptions |