Learn R Programming

segmented (version 0.2-5)

seg.control: Auxiliary for controlling segmented model fitting

Description

Auxiliary function as user interface for 'segmented' fitting. Typically only used when calling any 'segmented' method (segmented.lm or segmented.glm).

Usage

seg.control(toll = 1e-04, it.max = 20, display = FALSE, last = TRUE,
    maxit.glm = 25, h = 1)

Arguments

toll
positive convergence tolerance.
it.max
integer giving the maximal number of iterations.
display
logical indicating if output should be produced for each iteration.
last
logical indicating if output should include only the last fitted model.
maxit.glm
integer giving the maximum number of inner IWLS iterations (see details).
h
positive factor (from zero to one) modifying the increments in breakpoint estimation (see details).

Value

  • A list with the arguments as components.

Details

Fitting a `segmented' model is attained via fitting iteratively standard GLMs. The number of iteration is governed by it.max, while the (maximum) number of (inner) iterations to fit the GLM at each outer iteration is fixed via maxit.glm. Usually three-four inner iterations may be sufficient. If last=TRUE, the object resulting from segmented.lm (or segmented.glm) is a list of fitted GLM; the i-th model is the segmented model with the values of the breakpoints at the i-th iteration. Sometimes to stabilize the procedure, it can be useful to set h<1< code=""> to reduce the increments in the breakpoint estimation. At each iteration the updated estimate is usually given by psi.new=psi.old+increm. By setting h<1< code=""> (actually min(abs(h),1) is considered) causes the following alterations to the algorithm: (i) the actual maximum number of iterations is increased up to it.max+round(it.max/2) and (ii) the breakpoint update is computed via psi.new=psi.old+h*increm after the it.max-th iteration.

Examples

Run this code
#decrease the maximum number inner iterations and display the 
     #evolution of the (outer) iterations
     seg.control(display = TRUE, maxit.glm=4)

Run the code above in your browser using DataLab