Description Usage Arguments Value Methods References See Also Examples

Approximately draw from a posterior distribution using variational inference.

This is still considered an experimental feature.
We recommend calling `stan`

or `sampling`

for
final inferences and only using `vb`

to get a rough idea of the parameter
distributions.

1 2 3 4 5 6 7 |

`object` |
An object of class |

`data` |
A named |

`pars` |
If not |

`include` |
Logical scalar defaulting to |

`seed` |
The seed for random number generation. The default is generated
from 1 to the maximum integer supported by |

`init` |
Initial values specification. See the detailed documentation for
the init argument in |

`check_data` |
Logical, defaulting to |

`sample_file` |
A character string of file name for specifying where to
write samples for |

`algorithm` |
Either |

`...` |
Other optional parameters: -
`iter` (positive`integer` ), the maximum number of iterations, defaulting to 10000. -
`grad_samples` (positive`integer` ), the number of samples for Monte Carlo estimate of gradients, defaulting to 1. -
`elbo_samples` (positive`integer` ), the number of samples for Monte Carlo estimate of ELBO (objective function), defaulting to 100. (ELBO stands for "the evidence lower bound".) -
`eta` (`double` ), positive stepsize weighting parameter for variational inference but is ignored if adaptation is engaged, which is the case by default. -
`adapt_engaged` (`logical` ), a flag indicating whether to automatically adapt the stepsize, defaulting to`TRUE` . -
`tol_rel_obj` (positive`double` ), the convergence tolerance on the relative norm of the objective, defaulting to 0.01. -
`eval_elbo` (positive`integer` ), evaluate ELBO every Nth iteration, defaulting to 100. -
`output_samples` (positive`integer` ), number of posterior samples to draw and save, defaults to 1000. -
`adapt_iter` (positive`integer` ), the maximum number of iterations to adapt the stepsize, defaulting to 50. Ignored if`adapt_engaged = FALSE` .
Refer to the manuals for both CmdStan and Stan for more details. |

An object of `stanfit-class`

.

- vb
`signature(object = "stanmodel")`

Call Stan's variational Bayes methods
for the model defined by S4 class `stanmodel`

given the data, initial values, etc.

The Stan Development Team
*Stan Modeling Language User's Guide and Reference Manual*.
http://mc-stan.org.

The Stan Development Team
*CmdStan Interface User's Guide*.
http://mc-stan.org.

The manuals of CmdStan and Stan.

1 2 3 4 5 | ```
## Not run:
m <- stan_model(model_code = 'parameters {real y;} model {y ~ normal(0,1);}')
f <- vb(m)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.