create_stan_file {makemyprior}R Documentation

Create a "skeleton" for custom Stan code

Description

Makes and saves files with generic code for writing custom Stan code and still use the HD prior.

Usage

create_stan_file(save = FALSE, location = "")

Arguments

save

To confirm that files can be saved (default FALSE).

location

Path to location.

Details

Must be in an interactive session to store the code. A folder called "my_stan_code" will be created in location. If the folder already exists in the specified location, you get an error. The folder contains:

main_file.stan

Main file. Can put all necessary functions here, but for a cleaner code that is easier to read, we put the functions in separate files.

jacobian.stan

Function that automatically computes the Jacobian, needed to transform from weights and total variance parameterization to log-variance parameterization.

prior_distributions.stan

Functions for computing the prior distributions.

The provided code is written so a random intercept model with an intercept, a group effect and a residual effect can be fitted:

example_custom_stan.R

R script showing how one can fit a random intercept model using the provided code.

The code can be expanded to fit the desired model. This requires some knowledge about Stan. No more documentation is given, as this is merely an offer to users who want to use other models than what are provided in the package already, and will be highly model specific.

Value

Nothing.

Examples

## Not run: 
create_stan_file(TRUE, "")

## End(Not run)


[Package makemyprior version 1.2.1 Index]