fit.glinv {glinvci} | R Documentation |
Fitting a GLInv model via numerical optimisation
Description
fit.glinv
finds the maximum likelihood estimate of a glinv
model by solving a numerical
optimisation problem.
Usage
## S3 method for class 'glinv'
fit(
object,
parinit = NULL,
method = "L-BFGS-B",
lower = -Inf,
upper = Inf,
use_optim = FALSE,
project = NULL,
projectArgs = NULL,
num_threads = 2L,
control = list(),
...
)
Arguments
object |
An object of class |
parinit |
A vector, parameter for initialisation of the optimisation routine. |
method |
One of |
lower |
A vector of lower bounds on the parameters. |
upper |
A vector of upper bounds on the parameters. |
use_optim |
If true, use optim's version of |
project |
Passed to |
projectArgs |
Passed to |
num_threads |
Number of threads to use when computing the gradient |
control |
Options to be passed into each the underlying optimisation routine's |
... |
Not used. |
Details
If method
is L-BFGS-B
, then lbfgsb3c
is used for optimisation;
if it is CG
then Rcgmin
from the optimx
package is used; if it
is BB
then BBoptim
is used, otherwise the method argument is passed to
optim
.
By default, L-BFGS-B
declares convergence when the change of function value is small, CG
tests stops when change of gradient squared-Euclidean-norm is small, BB
stops when either the
change of function values, or the infinity norm of a project gradient, is small. These can be changed
through the control
argument and the user should refer to the optimisation packages' respective
documentation for details.
The user can opt for using optim
's version of CG
and L-BFGS-B
. The
implementation in optim
of the methods does not incorporate improvements of the
methods in the recent decades, but they have stood the test of time.
If parinit
were not supplied and the distance between lower
and upper
is infinite,
the initialisation point of the optimisation is drawn from a uniform distribution ranging [-1,1]
distribution. If initalisation were not supplied, but the distance between lower
and upper
is finite, then the initialisation is drawn from a uniform distribution ranging
[lower
, upper
].
Value
fit.glinv
returns a list containing at least the following elements:
mlepar |
The maximum likelihood estimate. |
loglik |
The log-likelihood at the maximum likelihood estimate. |
score |
The gradient of log-likelihood at the maximum likelihood estimate. |
convergence |
Zero if the optimisation routine has converged successfully. |
message |
A message from the optimisation routine. |