You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CmdStan itself provides a `stansummary` utility that can be called using the
@@ -351,20 +333,11 @@ the `$sample()` method demonstrated above.
351
333
352
334
We can find the (penalized) maximum likelihood estimate (MLE) using [`$optimize()`](https://mc-stan.org/cmdstanr/reference/model-method-optimize.html).
To summarise all variables with non-default functions, it is necessary to set explicitly set the variables argument, either to `NULL` or the full vector of variable names.
63
-
```{r eval=FALSE}
42
+
To summarize all variables with non-default functions, it is necessary to set explicitly set the variables argument, either to `NULL` or the full vector of variable names.
Summary functions can be specified by character string, function, or using a formula (or anything else supported by [rlang::as_function]). If these arguments are named, those names will be used in the tibble output. If the summary results are named they will take precedence.
73
-
```{r eval=FALSE}
49
+
```{r}
74
50
my_sd <- function(x) c(My_SD = sd(x))
75
51
fit$summary(
76
52
c("mu", "tau"),
@@ -81,58 +57,31 @@ fit$summary(
81
57
Minimum = function(x) min(x)
82
58
)
83
59
```
84
-
```{r echo=FALSE}
85
-
my_sd <- function(x) c(My_SD = sd(x))
86
-
print.data.frame(fit$summary(
87
-
c("mu", "tau"),
88
-
MEAN = mean,
89
-
"median",
90
-
my_sd,
91
-
~quantile(.x, probs = c(0.1, 0.9)),
92
-
Minimum = function(x) min(x)
93
-
))
94
-
```
95
-
96
60
97
61
Arguments to all summary functions can also be specified with `.args`.
For this reason users may have unexpected results if they use `stats::var()` directly, as it will return a covariance matrix. An alternative is the `distributional::variance()` function,
115
73
which can also be accessed via `posterior::variance()`.
0 commit comments