Description Usage Arguments Details Value Examples
View source: R/normal_poisson_log_likelihood.R
A simple optimizer for log-likelihoods or other functions.
1 | brix_simple(optimizer, fn, X, N, ...)
|
optimizer |
recommended choice is |
fn |
function to be optimized. |
X |
|
N |
|
... |
additional arguments passed to the |
The optimizer must always be specified first.
The function to be optimized must always be specified second.
See e.g. optim
for the optimizer.
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. |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.