Gather_Guesses_CPP {Colossus} | R Documentation |
Performs checks to gather a list of guesses and iterations
Description
Gather_Guesses_CPP
called from within R, uses a list of options and the model definition to generate a list of parameters and iterations that do not produce errors
Usage
Gather_Guesses_CPP(
df,
dfc,
names,
term_n,
tform,
keep_constant,
a_n,
x_all,
a_n_default,
modelform,
control,
guesses_control,
model_control = list()
)
Arguments
df |
a data.table containing the columns of interest |
dfc |
vector matching subterm number to matrix column |
names |
columns for elements of the model, used to identify data columns |
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 the number of parameters. May be either a list of vectors or a single vector. |
x_all |
covariate matrix |
a_n_default |
center of parameter distribution guessing scope |
modelform |
string specifying the model type: M, ME, A, PA, PAE, GMIX, GMIX-R, GMIX-E |
control |
list of parameters controlling the convergence, see Def_Control() for options or vignette("Control_Options") |
guesses_control |
list of parameters to control how the guessing works, see Def_Control_Guess() for options or vignette("Control_Options") |
model_control |
controls which alternative model options are used, see Def_model_control() for options and vignette("Control_Options") for further details |
Value
returns a list of the final results
Examples
library(data.table)
a <- c(0, 1, 2, 3, 4, 5, 6)
b <- c(1, 2, 3, 4, 5, 6, 7)
c <- c(0, 1, 0, 0, 0, 1, 0)
d <- c(3, 4, 5, 6, 7, 8, 9)
df <- data.table::data.table("a" = a, "b" = b, "c" = c, "d" = d)
time1 <- "a"
time2 <- "b"
event <- "c"
names <- c("d")
term_n <- c(0)
tform <- c("loglin")
keep_constant <- c(0)
a_n <- c(-0.1)
a_n_default <- a_n
modelform <- "M"
control <- list(
"ncores" = 2, "lr" = 0.75, "maxiter" = -1,
"halfmax" = 5, "epsilon" = 1e-9,
"deriv_epsilon" = 1e-9, "abs_max" = 1.0,
"dose_abs_max" = 100.0, "verbose" = FALSE, "ties" = "breslow",
"double_step" = 1
)
guesses_control <- list()
model_control <- list()
all_names <- unique(names(df))
dfc <- match(names, all_names)
term_tot <- max(term_n) + 1
x_all <- as.matrix(df[, all_names, with = FALSE])
control <- Def_Control(control)
guesses_control <- Def_Control_Guess(guesses_control, a_n)
model_control <- Def_model_control(model_control)
options(warn = -1)
Gather_Guesses_CPP(
df, dfc, names, term_n, tform, keep_constant,
a_n, x_all, a_n_default,
modelform, control, guesses_control
)