Correct_Formula_Order {Colossus}R Documentation

Corrects the order of terms/formula/etc

Description

Correct_Formula_Order checks the order of formulas given and corrects any ordering issues

Usage

Correct_Formula_Order(
  Term_n,
  tform,
  keep_constant,
  a_n,
  names,
  der_iden = 0,
  Cons_Mat = matrix(c(0)),
  Cons_Vec = c(0),
  verbose = FALSE
)

Arguments

Term_n

term numbers for each element of the model

tform

list of string function identifiers, used for linear/step

keep_constant

binary values to denote which parameters to change

a_n

list of initial parameter values, used to determine number of parameters

names

columns for elements of the model, used to identify data columns

der_iden

number for the subterm to test derivative at, only used for testing runs with a single varying parameter, should be smaller than total number of parameters

Cons_Mat

Matrix containing coefficients for system of linear constraints, formatted as matrix

Cons_Vec

Vector containing constants for system of linear constraints, formatted as vector

verbose

boolean to control if additional information is printed to the console, also accepts 0/1 integer

Value

returns the corrected lists

See Also

Other Data Cleaning Functions: Check_Dupe_Columns(), Check_Trunc(), Date_Shift(), Def_Control(), Def_Control_Guess(), Def_model_control(), Def_modelform_fix(), Joint_Multiple_Events(), Replace_Missing(), Time_Since(), factorize(), factorize_par(), gen_time_dep(), interact_them()

Examples

library(data.table)
## basic example code reproduced from the starting-description vignette

Term_n <- c(0,1,1,0,0)
tform <- c("loglin",'quad_slope','lin', "lin_int", "lin_slope")
keep_constant <- c(0,0,0,1,0)
a_n <- c(1,2,3,4,5)
names <- c("a","a","a","a","a")
val <- Correct_Formula_Order(Term_n, tform, keep_constant,
                             a_n, names, Cons_Mat=matrix(c(0)),
                             Cons_Vec=c(0))
Term_n <- val$Term_n
tform <- val$tform
keep_constant <- val$keep_constant
a_n <- val$a_n
der_iden <- val$der_iden
names <- val$names


[Package Colossus version 1.1.1 Index]