modeller_from_loglik: Create your own modelling function, given a log-likelihood...

Description Usage Arguments Value

Description

This function takes a log-likelihood function, and returns a modelling function, much like stats:lm or stats:glm. This modelling function will find coefficients that maximize the likelihood.

Usage

1
2
modeller_from_loglik(loglik_fun, penalty_fun = function(...) return(0),
  non_parameter_args = character())

Arguments

loglik_fun

A function whose first argument is the target variable, and whose subsequent arguments are parameters of the distribution which gives the log-likelihood. (You can indicate arguments that are *not* parameters with non_parameter_args.)

penalty_fun

Optional. A function which, when given a dataframe with columns c('parameter', 'term', 'beta'), yields a penalty term (a positive number to be added to the function to be minimized by stats::optim).

non_parameter_args

A character-vector indicating arguments to loglik_fun that are not parameters. (This is in addition to the first argument, which is always assumed to be the target variable, not a parameter.)

Value

A modelling function. See modeller_template.


strongio/keanu documentation built on May 8, 2019, 11:16 p.m.