Package: greta 0.6.0

Nicholas Tierney

greta: Simple and 'Scalable' Statistical Modelling in R

Write statistical models in R and fit them by 'MCMC' and optimisation on 'CPUs' and 'GPUs', using Google 'TensorFlow'. 'greta' lets you write your own model like in 'BUGS', 'JAGS' and 'Stan', except that you write models right in R, it scales well to massive datasets, and it’s easy to extend and build on. See the website for more information, including tutorials, examples, package documentation, and the 'greta' forum. This work is discussed at Golding (2019) <doi:10.21105/joss.01601>.

Authors:Nick Golding [aut, cph], Nicholas Tierney [aut, cre], Simon Dirmeier [ctb], Adam Fleischhacker [ctb], Shirin Glander [ctb], Martin Ingram [ctb], Lee Hazel [ctb], Lionel Hertzog [ctb], Tiphaine Martin [ctb], Matt Mulvahill [ctb], Michael Quinn [ctb], David Smith [ctb], Paul Teetor [ctb], Jian Yen [ctb]

greta_0.6.0.tar.gz
greta_0.6.0.tar.gz(r-4.7-any)greta_0.6.0.tar.gz(r-4.6-any)
greta_0.6.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
greta/json (API)

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

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

Pkgdown/docs site:https://greta-dev.github.io

Datasets:

On CRAN:

Conda:

3.98 score 4 packages 45 downloads 2 mentions 131 exports 46 dependencies

Last updated from:89cb030cc6. Checks:4 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK216
source / vignettesOK264
linux-release-x86_64OK208
wasm-releaseOK155

Exports:.internals%*%%o%abindadadeltaadagradadagrad_daadamadamaxapplyas_dataas.greta_modelas.unknownsbacksolvebernoullibetabeta_binomialbfgsbinomialcalculatecategoricalcauchycgchi_squaredchol2invchol2symmcholesky_variablecobylacolMeanscolSumscov2corcpu_onlydestroy_greta_depsdiagdirichletdirichlet_multinomialdistributiondistribution<-eigenexponentialextra_samplesfforwardsolveftrlgammagpu_onlygradient_descentgreta_arraygreta_create_conda_envgreta_deps_receiptgreta_deps_specgreta_install_minicondagreta_list_py_modulesgreta_notes_tf_num_errorgreta_removegreta_remove_all_depsgreta_reset_pythongreta_set_depsgreta_set_install_logfilegreta_set_pythongreta_sitrephmchypergeometricicauchiticloglogidentityilogitimultilogitinitialsinstall_greta_depsinstall_tensorflowinverse_gammaiprobitis.greta_arrayis.greta_mcmc_listjointl_bfgs_blaplacelkj_correlationlog1pelogisticlognormalmcmcmixturemodelmomentummultinomialmultivariate_normalnadamnegative_binomialnelder_meadnewton_cgnormalonesopen_greta_install_logoptordered_variableouterparetopoissonpowellproximal_adagradproximal_gradient_descentpy_module_availablepy_versionrdistreinstall_greta_depsreinstall_greta_envreinstall_minicondaremove_greta_envremove_minicondaremove_reticulate_uv_cacherms_proprowMeansrowSumsrun_optimiserrwmhsimplex_variablesliceslsqpstashed_samplesstudentsweeptapplytncuniformvariableweibullwishartwrite_greta_install_logzeros

Dependencies:abindbackportsbase64enccallrclicodacodetoolsconfigcrayondigestfutureglobalsglueherehmsjsonlitelatticelifecyclelistenvmagrittrMatrixotelparallellypkgconfigpngprettyunitsprocessxprogresspsR6rappdirsRcppRcppTOMLreticulaterlangrprojrootrstudioapitensorflowtfautographtfrunstidyselectvctrswhiskerwithryamlyesno

Example models
Common models | Linear regression | Multiple linear regression | Multiple Poisson regression | Multiple categorical regression | Multiple linear regression with LASSO prior | Hierarchical linear regression | Random intercept-slope model | Random intercept-slope model (with correlated effects) | Common Bayesian priors | Improper flat prior | Ridge prior | Exponential-normal prior | Horseshoe prior | Regularized horseshoe prior | Advanced Bayesian models | Hierarchical linear regression in general conditional formulation | Hierarchical linear regression in general marginal formulation | Bayesian neural network | Factor analysis | BUGS models | Air | data | greta code | BUGS/JAGS code | Stan code | Beetles | Stan models | Lightspeed | Eight schools | Ecological models | Logistic regression | Poisson regression | Logistic regression with error term | Multiple species modelling independently and concurrently | Multiple species with partial pooling of regression coefficients | Multiple species with sub-model for regression coefficients | Cormack-Jolly-Seber model

Last update: 2026-07-20
Started: 2017-06-26

FAQ
How do I install greta dependencies? | How do I know if greta has the right versions of Python dependencies installed? | Is there an alternative way to install Python dependencies? | I get the message: "Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2"

Last update: 2026-07-20
Started: 2022-03-15

Get started with greta
Installation | Installing TensorFlow | DiagrammeR | How greta works | Building a model | Data | explicit vs. automatic conversion | data structures | Variables and priors | variables without probability distributions | variables with probability distributions | variables with truncated distributions | Operations | Extract and replace | Functions | Likelihood | Defining the model | Plotting | Sampling | Tweaking the sampler

Last update: 2026-07-20
Started: 2017-06-26

Installing dependencies
Quick start | Did it work? | How greta uses Python | When the default isn't right | Using greta offline | Prime the managed (uv) environment while online | Pin dependency versions | I already have Python or TensorFlow installed | I need specific dependency versions | I want the conda workflow | How install_greta_deps() works | Advanced: how greta chooses a Python environment | Starting over | Troubleshooting

Last update: 2026-07-20
Started: 2024-11-12

Readme and manuals

Help Manual

Help pageTopics
convert other objects to greta arraysas_data
Convert object to a "greta_model" objectas.greta_model
Create objects of class 'unknowns' to nicely print ? valued arraysas.unknowns
calculate greta arrays given fixed valuescalculate
Compute the Cholesky Factor of a Matrixchol.greta_array
Cholesky Factor to Symmetric Matrixchol2symm
generic to grab dimensions of nodesdim.node
set dims like on a matrix/arraydim<-.unknowns
define a distribution over datadistribution distribution<-
probability distributionsbernoulli beta beta_binomial binomial categorical cauchy chi_squared dirichlet dirichlet_multinomial distributions exponential f gamma hypergeometric inverse_gamma laplace lkj_correlation logistic lognormal multinomial multivariate_normal negative_binomial normal pareto poisson student uniform weibull wishart
extract, replace and combine greta arraysc.greta_array cbind.greta_array diag.greta_array dim.greta_array dim<-.greta_array extract extract-replace-combine head.greta_array length.greta_array rbind.greta_array rep.greta_array replace tail.greta_array [.greta_array [<-.greta_array
functions for greta arraysfunctions
Set GPU or CPU usagecpu_only gpu_cpu gpu_only
greta: simple and scalable statistical modelling in Rgreta-package greta
Create conda environment for gretagreta_create_conda_env
Capture greta python dependencies.greta_deps_receipt
Specify python dependencies for gretagreta_deps_spec
Suggested valid Python dependencies for gretagreta_deps_tf_tfp
Installs minicondagreta_install_miniconda
List Python modules installed in greta envgreta_list_py_modules
Retrieve python messages.greta_notes_tf_num_error
Remove greta's Python dependenciesgreta_remove
Choose the dependency versions greta installsgreta_set_deps
Set logfile path when installing gretagreta_set_install_logfile
Choose the Python environment greta usesgreta_reset_python greta_set_python
Greta Situation Reportgreta_sitrep
Statistical inference on greta models.extra_samples inference initials mcmc opt stashed_samples
Install Python dependencies for gretainstall_greta_deps reinstall_greta_deps
internal greta methods.internals internals
Is object a greta array?is.greta_array
Is object a 'greta_mcmc_list'?is.greta_mcmc_list
define joint distributionsjoint
mixtures of probability distributionsmixture
greta model objectsmodel plot.greta_model print.greta_model
Read a greta logfileopen_greta_install_log
arithmetic, logical and relational operators for greta arraysoperators
optimisation methodsadadelta adagrad adagrad_da adam adamax bfgs cg cobyla ftrl gradient_descent l_bfgs_b momentum nadam nelder_mead newton_cg optimisers powell proximal_adagrad proximal_gradient_descent rms_prop slsqp tnc
Functions overloaded by greta%*% %o% abind apply backsolve chol2inv colMeans colSums cov2cor diag eigen forwardsolve identity outer overloaded rdist rowMeans rowSums sweep tapply
Print method for greta python depsprint.greta_deps_spec
Print method for greta MCMC listprint.greta_mcmc_list
Dispatch optimisation method to right classrun_optimiser
MCMC samplershmc rwmh samplers slice
Simulate Responses From 'greta_model' Objectsimulate.greta_model
create data greta arraysgreta_array ones structures zeros
transformation functions for greta arraysicauchit icloglog ilogit imultilogit inverse-links iprobit log1pe transforms
create greta variablescholesky_variable ordered_variable simplex_variable variable
Write greta dependency installation log filewrite_greta_install_log