add_constraint_to_model: Add a constraint to a model

Description Usage Arguments Value Details Examples

View source: R/FIT-models.R

Description

This function adds a constraint to a model. Models can only have one constraint per parameter. Running this function multiple times with the same model and parameter will replace the existing constraint.

Usage

1
add_constraint_to_model(model, parameter, constraint_type, constraint)

Arguments

model

The model object for which the the constraint should be added

parameter

The name of the parameter for which the constraint will be added

constraint_type

The type of constraint to add, one of ("range", "vary", "variable_range") – see details

constraint

Either c(min, max) value or c(value, min, max) depending on constraint_type – see details

Value

A model object

Details

There are 3 types of constraint currently implemented:

Values of the constraint parameter are thus:

Examples

1
2
3
add_constraint_to_model(model, "height", "range", c(0, 1))
add_constraint_to_model(model, "height", "vary", 0.5)
add_constraint_to_model(model, "height", "variable_range", c(0.5, 0, 1))

jmstrat/NMR.Utils documentation built on July 14, 2019, 11:35 p.m.