fit_p2_IS: Improve the fit of p2 models

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/IS.R

Description

Estimates a p2 model using parameter dependent Laplace Importance Sampling.

Usage

1
2
3
fit_p2_IS(objfit, M = 5000, ncores = 1, init = NULL,
  init.hess = TRUE, seed = NULL, trace = 0, hessian = 1,
  grtol = 1e-06, xtol = 1e-12)

Arguments

objfit

An object produced by a call to fit_p2.

M

number of importance sampling simulations. Default is M=5000.

ncores

Number of cores to employ.

init

Starting point for the model parameter value. If it is NULL, the theta slot of objfit is used.

init.hess

Should the hessian matrix from fit_p2 be used as the initial Hessian by the ucminf optimiser? Default is TRUE.

seed

Random seed for the importance sampler.

trace, hessian, grtol, xtol

Arguments for the ucminf optimiser. For their meaning, see the help file for that function.

Details

The function can be called only after fitting a model by fit_p2, so that all the model settings are inherited from those employed in the call tofit_p2. The function can take advantage of multiple cores for parallel evaluation of the samples simulated by the importance sampler. The optimiser used is ucminf, which can exploit the estimated Hessian from fit_p2 in a Quasi-Newton optimisation.

Value

The returned value is an object of class "p2", a list containing the same components listed for fit_p2.

Author(s)

Ruggero Bellio

See Also

fit_p2, ucminf

Examples

1
2
3
4
5
## Not run: 
mod <- fit_p2(Y, Xn, Xn, XvD, XvC)
nc <- parallel::detectCores()
modIS <- fit_p2_IS(mod, ncores=nc)
## End(Not run)

rugbel/p2model documentation built on March 8, 2021, 8:16 p.m.