colf_nlxb: Nash Variant of the Marquardt algorithm on a linear objective...

Description Usage Arguments Details Value See Also Examples

Description

Non linear least squares solution via qr linear solver on a linear objective function.

Usage

1
2
3
colf_nlxb(formula, data, start = NULL, trace = FALSE, lower = -Inf,
  upper = Inf, na.action = c("na.omit", "na.fail", "na.exclude"),
  masked = NULL, control = NULL, ...)

Arguments

formula

The formula. This has the same syntax and supports the same features as the formula in lm. See examples.

data

A data frame containing the data of the variables in the formula.

start

An atomic vector of same length as the number of parameters. If not provided a cheap guess will be made. If categorical variables are included these need to be takent into consideration as number of categories minus one. See examples and details.

trace

Logical. Defaults to FALSE. Set to TRUE if you want the intermediate progress to be reported

lower

Lower bounds of the parameters (atomic vector). If a single number, this will be applied to all parameters. Defaults to -Inf (unconstrained).

upper

Upper bounds of the parameters (atomic vector). If a single number, this will be applied to all parameters. Defaults to Inf (unconstrained).

na.action

A function which indicates what should happen if NAs are present in the data set. Defaults to options('na.action'). na.fail, or na.exclude can be used.

masked

Character vector of parameter names. These parameters will not be altered by the algorithm.

control

A list of controls for the algorithm. These are:

  • watch - Monitor progress. Logical, defaults to FALSE

  • phi - Adds phi*identity to Jacobian inner product. Defaults to 1.

  • lamda - Initial Marquardt adjustment. Defaults to 0.0001.

  • offset - Shift to test floating point equality. Defaults to 100.

  • laminc - Factor to use to increase lamda. Defaults to 10.

  • lamdec - Factor to use to decrease lamda (lamdec / laminc). Defaults to 4.

  • femax - Maximum evaluations of sum of squares function. Defaults to 10000.

  • jemax - Maximum evaluations of the Jacobian. Defaults to 5000.

  • rofftest - Use a termination of the relative offset orthogonality type.

  • smallsstest - Exit the function if the sum of squares falls below (100 * .Machine$double.eps)^4 times the initial sumsquares. Defaults to TRUE.

...

Other arguments passed on to optimiser

Details

colf_nlxb uses Nash's (Nash, 1979) variant of the Marquardt algorithm, in an attempt to find the minimum of the residual sum of squares. The algorithm is applied on a linear objective function.

The function provides an easy way to apply the optimizer on a linear objective function in a similar way to lm.

start, lower and upper, if provided, can be either an atomic vector which has the same length as the number of parameters or a single number which will be replicated to match the length of the parameters. If categorical variables exist in the function these will be dummified. Out of one categorical variable, n - 1 will be created where n is the total number of categories in the variable. This needs to be taken into account when providing an atomic vector for start, lower or upper. Also, as with lm an intercept will be added which also needs to be taken into account.

Value

Same as nlxb

See Also

nlxb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#no constraints
colf_nlxb(mpg ~ cyl + disp, mtcars)

#no intercept
colf_nlxb(mpg ~ 0 + cyl + disp, mtcars)

#including categorical variables. These will be dummified.
colf_nlxb(Sepal.Length ~ Sepal.Width + Species, iris)

#lower boundary will be replicated for all parameters 
colf_nlxb(Sepal.Length ~ Sepal.Width + Species, iris, lower = 0.5)

#species is categorical and contains 3 categories, thus we need to specify 4 lower bounds:
#the first one for the intercept.
#the second one for Sepal.Width 
#the two next for the dummy variables constructed from Species. 
colf_nlxb(Sepal.Length ~ Sepal.Width + Species, iris, lower = rep(0.5, 4))

LyzandeR/colf documentation built on May 8, 2019, 3:16 p.m.