greta-dev / greta-dev/greta

add R numeric versions of greta operation functions

Open
#263 0 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
C++
Stars
607
Forks
67
Avg merge
3d 8h
Merged PRs (30d)
1

Description

Most of greta's operation function map existing base R functions for numeric objects to work with greta arrays; e.g. we add a `exp.greta_array()` so you can do `exp(some_greta_array)`. However some are new, or have different names than base R functions. These include the link functions: `iprobit()`, `ilogit()`, `icloglog()`, `log1pe()`, `imultilogit()`, and probably others.

It won't be immediately obvious to most users how to create R versions of these for testing their intuition or creating data-simulating functions. If they try to use them on R numerics, the inputs will be coerced to data greta arrays and an operation greta array returned. If they then force conversion to a matrix, they'll get a matrix of NAs.

It would be nicer if these were instead generic functions with methods both for greta arrays (using the current behaviour) and for R numerics, using e.g. `stats::binomial("probit")$linkinv()` for `iprobit.default()` (I believe these link functions are slightly more computationally efficient than CDFs like `stats::pnorm()`).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.