Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
macartan committed Nov 4, 2024
2 parents 47d6a07 + 626c020 commit 99595fa
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 115 deletions.
37 changes: 37 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
# CausalQueries 1.2.0

This is a minor release introducing changes meant to focus S3 methods and
utility functions around two core classes: `causal_model` and `model_query`.
Our aim is to improve the user experience of `CausalQueries` by focusing
user facing functionality more clearly around the workflow of making, updating,
querying and inspecting causal models.
With respect to `causal_model` objects this release introduces more expressive
and concise S3 summary and print methods for the `causal_model` class and its
internal objects. Updates to the `grab()` and `inspect()` functions streamline
access to objects contained within a `causal_model`, facilitating more advanced
use-cases or deeper review.
This release introduces the `model_query` class along with S3 summary, print and
plot methods for a more seamless querying workflow.
Finally, this release removes dependency on `dagitty`, restoring compatibility of
`CausalQueries` with systems on which `V8` `JavaScript` `WASM` is not supported.

### New Functionality

#### 1. Improved causal_model summaries
The `summary()` method for objects of class `causal_model` now supports an
`include` argument allowing users to specify additional objects internal
to the `causal_model` object for which they would like to have summaries
appended to the main output of `summary()`. Summaries have additionally been
made more informative and readable. Please see `?summary.causal_model` for
extensive documentation on the new functionality.

#### 2. Streamlined causal_model object access
Internal objects of a `causal_model` instance can now be returned quietly
via `grab()` eliminating the need to interact with a `causal_model` instance
directly.

#### 3. New querying utility functionality
The newly introduced `model_query` class comes with a print, summary and plot
method. `plot()` generates a coefficient plot with credible intervals for
evaluated queries.

# CausalQueries 1.1.1

This is a patch release fixing a bug in the `print.model_query()` S3 method that
Expand Down
2 changes: 1 addition & 1 deletion R/stanmodels.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ stanmodels <- sapply(stanmodels, function(model_name) {
model_name = stanfit$model_name,
model_code = stanfit$model_code,
model_cpp = stanfit$model_cpp,
mk_cppmodule = function(x) get(paste0("rstantools_model_", model_name)))
mk_cppmodule = function(x) get(paste0("model_", model_name)))
})
17 changes: 6 additions & 11 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
This is a patch release fixing a bug in the `print.model_query()` S3 method that
occurred when querying models using `paramters`.
This is a minor release introducing changes focusing S3 methods and
utility functions around two core classes: `causal_model` and `model_query`.

## Test environments

* local Ubuntu 22.04.3 LTS install, R 4.3.2
* win-builder, R version 4.4.0 beta
* win-builder, R version 4.2.3
* local Ubuntu 22.04.3 LTS install, R 4.4.1
* win-builder, R version 4.4.1
* win-builder, R version 4.3.3
* win-builder, R r-devel
* macOS, R version 4.3.3
* R-hub Windows Server (r-devel)
* R-hub Fedora Linux, clang, gfortran (r-devel)

## R CMD check results

0 errors | 0 warnings | 1 note
0 errors | 0 warnings | 0 notes

```
❯ checking for GNU extensions in Makefiles ... NOTE
GNU make is a SystemRequirements.
```
Explanation: GNU make is required for packages built using rstantools. The requirement is specified in the DESCRIPTION file.



5 changes: 2 additions & 3 deletions src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

STANHEADERS_SRC = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "message()" -e "cat(system.file('include', 'src', package = 'StanHeaders', mustWork = TRUE))" -e "message()" | grep "StanHeaders")

STANC_FLAGS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "cat(ifelse(utils::packageVersion('rstan') >= '2.26', '-DUSE_STANC3',''))")
PKG_CPPFLAGS = -I"../inst/include" -I"$(STANHEADERS_SRC)" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DRCPP_PARALLEL_USE_TBB=1 $(STANC_FLAGS) -D_HAS_AUTO_PTR_ETC=0
PKG_CPPFLAGS = -I"../inst/include" -I"$(STANHEADERS_SRC)" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DRCPP_PARALLEL_USE_TBB=1
PKG_CXXFLAGS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "RcppParallel::CxxFlags()") $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "StanHeaders:::CxxFlags()")
PKG_LIBS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "RcppParallel::RcppParallelLibs()") $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "StanHeaders:::LdFlags()")

CXX_STD = CXX17
CXX_STD = CXX14
2 changes: 1 addition & 1 deletion src/stanExports_simplexes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using namespace Rcpp ;
RCPP_MODULE(stan_fit4simplexes_mod) {


class_<rstan::stan_fit<stan_model, boost::random::ecuyer1988> >("rstantools_model_simplexes")
class_<rstan::stan_fit<stan_model, boost::random::ecuyer1988> >("model_simplexes")

.constructor<SEXP,SEXP,SEXP>()

Expand Down
198 changes: 99 additions & 99 deletions src/stanExports_simplexes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#ifndef MODELS_HPP
#define MODELS_HPP
#define STAN__SERVICES__COMMAND_HPP
#include <rstan/rstaninc.hpp>
#ifndef USE_STANC3
#define USE_STANC3
#endif
#include <rstan/rstaninc.hpp>
// Code generated by stanc v2.32.2
#include <stan/model/model_header.hpp>
namespace model_simplexes_namespace {
Expand All @@ -29,104 +29,104 @@ using namespace stan::math;
stan::math::profile_map profiles__;
static constexpr std::array<const char*, 99> locations_array__ =
{" (found before start of program)",
" (in 'string', line 33, column 0 to column 47)",
" (in 'string', line 36, column 0 to column 43)",
" (in 'string', line 37, column 0 to column 41)",
" (in 'string', line 38, column 0 to column 33)",
" (in 'string', line 39, column 0 to column 33)",
" (in 'string', line 40, column 0 to column 38)",
" (in 'string', line 41, column 0 to column 35)",
" (in 'string', line 42, column 0 to column 42)",
" (in 'string', line 92, column 0 to column 22)",
" (in 'string', line 51, column 4 to line 52, column 58)",
" (in 'string', line 53, column 4 to line 55, column 20)",
" (in 'string', line 50, column 36 to line 56, column 5)",
" (in 'string', line 50, column 7 to line 56, column 5)",
" (in 'string', line 47, column 4 to column 22)",
" (in 'string', line 48, column 4 to column 29)",
" (in 'string', line 46, column 32 to line 49, column 5)",
" (in 'string', line 46, column 2 to line 56, column 5)",
" (in 'string', line 45, column 26 to line 57, column 3)",
" (in 'string', line 45, column 0 to line 57, column 3)",
" (in 'string', line 60, column 0 to column 49)",
" (in 'string', line 63, column 1 to column 66)",
" (in 'string', line 62, column 21 to line 64, column 2)",
" (in 'string', line 62, column 0 to line 64, column 2)",
" (in 'string', line 67, column 2 to column 29)",
" (in 'string', line 66, column 21 to line 68, column 2)",
" (in 'string', line 66, column 0 to line 68, column 2)",
" (in 'string', line 70, column 1 to column 14)",
" (in 'string', line 72, column 1 to column 16)",
" (in 'string', line 95, column 3 to column 48)",
" (in 'string', line 94, column 21 to line 96, column 1)",
" (in 'string', line 94, column 0 to line 96, column 1)",
" (in 'string', line 93, column 32 to line 96, column 2)",
" (in 'string', line 93, column 0 to line 96, column 2)",
" (in 'string', line 98, column 4 to column 35)",
" (in 'string', line 97, column 33 to line 99, column 2)",
" (in 'string', line 97, column 1 to line 99, column 2)",
" (in 'string', line 77, column 2 to line 78, column 43)",
" (in 'string', line 79, column 2 to column 50)",
" (in 'string', line 76, column 26 to line 80, column 2)",
" (in 'string', line 76, column 0 to line 80, column 2)",
" (in 'string', line 84, column 2 to line 87, column 55)",
" (in 'string', line 83, column 26 to line 88, column 2)",
" (in 'string', line 83, column 0 to line 88, column 2)",
" (in 'string', line 9, column 0 to column 22)",
" (in 'string', line 10, column 0 to column 21)",
" (in 'string', line 11, column 0 to column 21)",
" (in 'string', line 12, column 0 to column 26)",
" (in 'string', line 13, column 0 to column 21)",
" (in 'string', line 14, column 6 to column 18)",
" (in 'string', line 14, column 0 to column 46)",
" (in 'string', line 15, column 0 to column 20)",
" (in 'string', line 16, column 0 to column 22)",
" (in 'string', line 17, column 0 to column 26)",
" (in 'string', line 18, column 0 to column 45)",
" (in 'string', line 19, column 16 to column 24)",
" (in 'string', line 19, column 0 to column 40)",
" (in 'string', line 20, column 6 to column 18)",
" (in 'string', line 20, column 0 to column 42)",
" (in 'string', line 21, column 6 to column 18)",
" (in 'string', line 21, column 0 to column 40)",
" (in 'string', line 22, column 6 to column 13)",
" (in 'string', line 22, column 0 to column 40)",
" (in 'string', line 23, column 6 to column 13)",
" (in 'string', line 23, column 0 to column 38)",
" (in 'string', line 24, column 6 to column 18)",
" (in 'string', line 24, column 0 to column 49)",
" (in 'string', line 25, column 6 to column 18)",
" (in 'string', line 25, column 0 to column 47)",
" (in 'string', line 26, column 7 to column 15)",
" (in 'string', line 26, column 17 to column 24)",
" (in 'string', line 26, column 0 to column 28)",
" (in 'string', line 27, column 7 to column 15)",
" (in 'string', line 27, column 17 to column 24)",
" (in 'string', line 27, column 0 to column 33)",
" (in 'string', line 28, column 7 to column 14)",
" (in 'string', line 28, column 16 to column 22)",
" (in 'string', line 28, column 0 to column 28)",
" (in 'string', line 29, column 24 to column 32)",
" (in 'string', line 29, column 33 to column 39)",
" (in 'string', line 29, column 0 to column 43)",
" (in 'string', line 30, column 6 to column 14)",
" (in 'string', line 30, column 0 to column 31)",
" (in 'string', line 33, column 16 to column 39)",
" (in 'string', line 36, column 25 to column 33)",
" (in 'string', line 37, column 16 to column 28)",
" (in 'string', line 38, column 7 to column 15)",
" (in 'string', line 38, column 17 to column 24)",
" (in 'string', line 39, column 7 to column 14)",
" (in 'string', line 39, column 16 to column 23)",
" (in 'string', line 40, column 25 to column 32)",
" (in 'string', line 41, column 25 to column 31)",
" (in 'string', line 42, column 25 to column 33)",
" (in 'string', line 92, column 7 to column 14)",
" (in 'string', line 3, column 15 to column 22)",
" (in 'string', line 3, column 4 to column 27)",
" (in 'string', line 4, column 4 to column 40)",
" (in 'string', line 5, column 4 to column 14)",
" (in 'string', line 2, column 32 to line 6, column 3)"};
" (in 'simplexes', line 33, column 0 to column 47)",
" (in 'simplexes', line 36, column 0 to column 43)",
" (in 'simplexes', line 37, column 0 to column 41)",
" (in 'simplexes', line 38, column 0 to column 33)",
" (in 'simplexes', line 39, column 0 to column 33)",
" (in 'simplexes', line 40, column 0 to column 38)",
" (in 'simplexes', line 41, column 0 to column 35)",
" (in 'simplexes', line 42, column 0 to column 42)",
" (in 'simplexes', line 92, column 0 to column 22)",
" (in 'simplexes', line 51, column 4 to line 52, column 58)",
" (in 'simplexes', line 53, column 4 to line 55, column 20)",
" (in 'simplexes', line 50, column 36 to line 56, column 5)",
" (in 'simplexes', line 50, column 7 to line 56, column 5)",
" (in 'simplexes', line 47, column 4 to column 22)",
" (in 'simplexes', line 48, column 4 to column 29)",
" (in 'simplexes', line 46, column 32 to line 49, column 5)",
" (in 'simplexes', line 46, column 2 to line 56, column 5)",
" (in 'simplexes', line 45, column 26 to line 57, column 3)",
" (in 'simplexes', line 45, column 0 to line 57, column 3)",
" (in 'simplexes', line 60, column 0 to column 49)",
" (in 'simplexes', line 63, column 1 to column 66)",
" (in 'simplexes', line 62, column 21 to line 64, column 2)",
" (in 'simplexes', line 62, column 0 to line 64, column 2)",
" (in 'simplexes', line 67, column 2 to column 29)",
" (in 'simplexes', line 66, column 21 to line 68, column 2)",
" (in 'simplexes', line 66, column 0 to line 68, column 2)",
" (in 'simplexes', line 70, column 1 to column 14)",
" (in 'simplexes', line 72, column 1 to column 16)",
" (in 'simplexes', line 95, column 3 to column 48)",
" (in 'simplexes', line 94, column 21 to line 96, column 1)",
" (in 'simplexes', line 94, column 0 to line 96, column 1)",
" (in 'simplexes', line 93, column 32 to line 96, column 2)",
" (in 'simplexes', line 93, column 0 to line 96, column 2)",
" (in 'simplexes', line 98, column 4 to column 35)",
" (in 'simplexes', line 97, column 33 to line 99, column 2)",
" (in 'simplexes', line 97, column 1 to line 99, column 2)",
" (in 'simplexes', line 77, column 2 to line 78, column 43)",
" (in 'simplexes', line 79, column 2 to column 50)",
" (in 'simplexes', line 76, column 26 to line 80, column 2)",
" (in 'simplexes', line 76, column 0 to line 80, column 2)",
" (in 'simplexes', line 84, column 2 to line 87, column 55)",
" (in 'simplexes', line 83, column 26 to line 88, column 2)",
" (in 'simplexes', line 83, column 0 to line 88, column 2)",
" (in 'simplexes', line 9, column 0 to column 22)",
" (in 'simplexes', line 10, column 0 to column 21)",
" (in 'simplexes', line 11, column 0 to column 21)",
" (in 'simplexes', line 12, column 0 to column 26)",
" (in 'simplexes', line 13, column 0 to column 21)",
" (in 'simplexes', line 14, column 6 to column 18)",
" (in 'simplexes', line 14, column 0 to column 46)",
" (in 'simplexes', line 15, column 0 to column 20)",
" (in 'simplexes', line 16, column 0 to column 22)",
" (in 'simplexes', line 17, column 0 to column 26)",
" (in 'simplexes', line 18, column 0 to column 45)",
" (in 'simplexes', line 19, column 16 to column 24)",
" (in 'simplexes', line 19, column 0 to column 40)",
" (in 'simplexes', line 20, column 6 to column 18)",
" (in 'simplexes', line 20, column 0 to column 42)",
" (in 'simplexes', line 21, column 6 to column 18)",
" (in 'simplexes', line 21, column 0 to column 40)",
" (in 'simplexes', line 22, column 6 to column 13)",
" (in 'simplexes', line 22, column 0 to column 40)",
" (in 'simplexes', line 23, column 6 to column 13)",
" (in 'simplexes', line 23, column 0 to column 38)",
" (in 'simplexes', line 24, column 6 to column 18)",
" (in 'simplexes', line 24, column 0 to column 49)",
" (in 'simplexes', line 25, column 6 to column 18)",
" (in 'simplexes', line 25, column 0 to column 47)",
" (in 'simplexes', line 26, column 7 to column 15)",
" (in 'simplexes', line 26, column 17 to column 24)",
" (in 'simplexes', line 26, column 0 to column 28)",
" (in 'simplexes', line 27, column 7 to column 15)",
" (in 'simplexes', line 27, column 17 to column 24)",
" (in 'simplexes', line 27, column 0 to column 33)",
" (in 'simplexes', line 28, column 7 to column 14)",
" (in 'simplexes', line 28, column 16 to column 22)",
" (in 'simplexes', line 28, column 0 to column 28)",
" (in 'simplexes', line 29, column 24 to column 32)",
" (in 'simplexes', line 29, column 33 to column 39)",
" (in 'simplexes', line 29, column 0 to column 43)",
" (in 'simplexes', line 30, column 6 to column 14)",
" (in 'simplexes', line 30, column 0 to column 31)",
" (in 'simplexes', line 33, column 16 to column 39)",
" (in 'simplexes', line 36, column 25 to column 33)",
" (in 'simplexes', line 37, column 16 to column 28)",
" (in 'simplexes', line 38, column 7 to column 15)",
" (in 'simplexes', line 38, column 17 to column 24)",
" (in 'simplexes', line 39, column 7 to column 14)",
" (in 'simplexes', line 39, column 16 to column 23)",
" (in 'simplexes', line 40, column 25 to column 32)",
" (in 'simplexes', line 41, column 25 to column 31)",
" (in 'simplexes', line 42, column 25 to column 33)",
" (in 'simplexes', line 92, column 7 to column 14)",
" (in 'simplexes', line 3, column 15 to column 22)",
" (in 'simplexes', line 3, column 4 to column 27)",
" (in 'simplexes', line 4, column 4 to column 40)",
" (in 'simplexes', line 5, column 4 to column 14)",
" (in 'simplexes', line 2, column 32 to line 6, column 3)"};
template <typename T0__,
stan::require_all_t<stan::is_eigen_matrix_dynamic<T0__>,
stan::is_vt_not_complex<T0__>>* = nullptr>
Expand Down

0 comments on commit 99595fa

Please sign in to comment.