smof_refit {smof}R Documentation

Re-fitting an existing smof model for improved optimization

Description

Given a model fitted by smof, this function helps to improve the achieved fitting level (represented by the value of the target criterion) by launching new numerical optimizations of the underlying target function. The search process is initiated with parameters randomly chosen in the vicinity of those of the object provided.

Usage

smof_refit(object, searches = 10, sd = 1, opt.control=list(), verbose = 1)

Arguments

object

an object returned by a call to smof; that call must include the argument original=TRUE.

searches

a positive integer representing the number of attempted searches.

sd

the standard deviation of the zero-mean normal variates used for earch search to generate the initial set of parameters from which to initiate a numerical optimization.

opt.control

a list passed to the optimization function (the same used to create object) as its control argument. It must not be used to turn the minimization problem into a maximization one.

verbose

an integer regulating the amount of messages displayed; it can be 0 (no messages), 1 (default value) or larger than 1 for a more verbose outcome.

Details

Section ‘Computational aspects’ of the smof documentation provides some simple suggestions to overcome numerical difficulties arising in the fitting process. For harder problems, smof_refit aims at improving the results obtained by an initial call to smof via a sequence of calls to smof itself, each time starting from the last best fit obtained up to that point.

In ‘regular’ situations, it is expected that the main usage of this function is to improve the fitting of models produced with scoring$type="spline", since this option typically generates a model with more parameters than an equivalent model with scoring$type="distr", hence generally more problematic at the optimization step.

Since the initial values of each optimization step are randomly generated (in the vicininy of the best known parameter set), it is advisable to make a preliminary call to set.seed, to ensure replicability of the results.

Value

an object of class smof

See Also

smof, set.seed

Examples

library(datasets)
data(esoph)
fit <- glm(cbind(ncases, ncontrols) ~ agegp + tobgp + alcgp, family=binomial(), data=esoph)
smof2 <- smof(fit, esoph, c("agegp", "alcgp"), 
             scoring=list(type="spline", in.knots=c(2,1)), original=TRUE)
set.seed(1)             
smof2a <- smof_refit(smof2, searches=4, opt.control=list(maxit=50))
# smof2b <- smof_refit(smof2a)  # further improvement can be attempted

[Package smof version 1.2.2 Index]