fit_prior: Find appropriate standard deviations for prior

View source: R/fit_prior.R

fit_priorR Documentation

Find appropriate standard deviations for prior

Description

Find appropriate standard deviations for prior

Usage

fit_prior(n_bins, n_draws = 10000, target = 1/n_bins, iterations = 5)

Arguments

n_bins

Bins for the Dirichlet distribution

n_draws

Numbers of samples to use for doing calculation

target

The goal of the specified prior, e.g. 1 or 1/n_bins

iterations

to try, to ensure robust solution. Defaults to 5

Value

A 3-element list consisting of sd (the approximate standard deviation in transformed space that gives a similar prior to that specified), value (the value of the root mean squared percent error function being minimized), and convergence (0 if convergence occurred, error code from optim() otherwise)

Examples


# fit model with 3 components / alpha = 1
set.seed(123)
f <- fit_prior(n_bins = 3, n_draws = 1000, target = 1)
# fit model with 20 components / alpha = 1/20
f <- fit_prior(n_bins = 20, n_draws = 1000, target = 1 / 20)



zoid documentation built on Sept. 12, 2023, 1:21 a.m.