brix_simple: Simple optimizer

Description Usage Arguments Details Value Examples

View source: R/normal_poisson_log_likelihood.R

Description

A simple optimizer for log-likelihoods or other functions.

Usage

1
brix_simple(optimizer, fn, X, N, ...)

Arguments

optimizer

recommended choice is optim.

fn

function to be optimized.

X

data.frame of claims and deductibles.

N

data.frame of occurrences and deductibles.

...

additional arguments passed to the optimizer, see examples.

Details

The optimizer must always be specified first. The function to be optimized must always be specified second. See e.g. optim for the optimizer.

Value

Returns an object of class "brix_simple". The function summary can also be used to print a summary of the model.

An object of class "brix" is a list containing at the function call and the results from the optimizer. The optimal parameters are named if applicable. The summary contains at least the following components:

call

the function call.

coefficients

the optimal coefficents.

value

the optimal value of the log-likelihood function.

AIC

the AIC of the log-likelihood.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Using optim for optimization
model <- brix_simple(optimizer = optim,
                     # function to be optimized
                     fn = normal_poisson_log_likelihood,
                     # arguments passed to fn
                     X = normal_poisson_x, N = normal_poisson_n,
                     # additional arguments passed to optim
                     par = rep(1, 3),
                     control = list(fnscale = -1),
                     method = "Nelder-Mead",
                     hessian = TRUE)
model
summary(model)

kbrix/brixtools documentation built on May 29, 2019, 2:25 p.m.