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 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 optim 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 very verbose outcome.

Details

The fitting step of a smof call, performed with the aid of optim, can run into problems with complex optimizations, typically when many parameters regulating the numeric scores are involved. This situation may be flagged by the message

Notice. Non-zero error code returned by optim:...

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 generates model with more parameters than an equivalent model with scoring$type="distr".

Since the initial values of each optimization step are randomly generated, one may want to make a preliminary call to set.seed. if replicability of the results is required.

Value

an object of class smof

See Also

smof, optim, 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(101)             
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.0 Index]