createControl {Cyclops} | R Documentation |
Create a Cyclops control object
Description
createControl
creates a Cyclops control object for use with fitCyclopsModel
.
Usage
createControl(
maxIterations = 1000,
tolerance = 1e-06,
convergenceType = "gradient",
cvType = "auto",
fold = 10,
lowerLimit = 0.01,
upperLimit = 20,
gridSteps = 10,
cvRepetitions = 1,
minCVData = 100,
noiseLevel = "silent",
threads = 1,
seed = NULL,
resetCoefficients = FALSE,
startingVariance = -1,
useKKTSwindle = FALSE,
tuneSwindle = 10,
selectorType = "auto",
initialBound = 2,
maxBoundCount = 5,
algorithm = "ccd",
doItAll = TRUE,
syncCV = FALSE
)
Arguments
maxIterations |
Integer: maximum iterations of Cyclops to attempt before returning a failed-to-converge error |
tolerance |
Numeric: maximum relative change in convergence criterion from successive iterations to achieve convergence |
convergenceType |
String: name of convergence criterion to employ (described in more detail below) |
cvType |
String: name of cross validation search.
Option |
fold |
Numeric: Number of random folds to employ in cross validation |
lowerLimit |
Numeric: Lower prior variance limit for grid-search |
upperLimit |
Numeric: Upper prior variance limit for grid-search |
gridSteps |
Numeric: Number of steps in grid-search |
cvRepetitions |
Numeric: Number of repetitions of X-fold cross validation |
minCVData |
Numeric: Minimum number of data for cross validation |
noiseLevel |
String: level of Cyclops screen output ( |
threads |
Numeric: Specify number of CPU threads to employ in cross-validation; default = 1 (auto = -1) |
seed |
Numeric: Specify random number generator seed. A null value sets seed via |
resetCoefficients |
Logical: Reset all coefficients to 0 between model fits under cross-validation |
startingVariance |
Numeric: Starting variance for auto-search cross-validation; default = -1 (use estimate based on data) |
useKKTSwindle |
Logical: Use the Karush-Kuhn-Tucker conditions to limit search |
tuneSwindle |
Numeric: Size multiplier for active set |
selectorType |
String: name of exchangeable sampling unit.
Option |
initialBound |
Numeric: Starting trust-region size |
maxBoundCount |
Numeric: Maximum number of tries to decrease initial trust-region size |
algorithm |
String: name of fitting algorithm to employ; default is |
doItAll |
Currently unused |
syncCV |
Currently unused Todo: Describe convegence types |
Value
A Cyclops control object of class inheriting from "cyclopsControl"
for use with fitCyclopsModel
.
Examples
#Generate some simulated data:
sim <- simulateCyclopsData(nstrata = 1, nrows = 1000, ncovars = 2, eCovarsPerRow = 0.5,
model = "poisson")
cyclopsData <- convertToCyclopsData(sim$outcomes, sim$covariates, modelType = "pr",
addIntercept = TRUE)
#Define the prior and control objects to use cross-validation for finding the
#optimal hyperparameter:
prior <- createPrior("laplace", exclude = 0, useCrossValidation = TRUE)
control <- createControl(cvType = "auto", noiseLevel = "quiet")
#Fit the model
fit <- fitCyclopsModel(cyclopsData,prior = prior, control = control)
#Find out what the optimal hyperparameter was:
getHyperParameter(fit)
#Extract the current log-likelihood, and coefficients
logLik(fit)
coef(fit)
#We can only retrieve the confidence interval for unregularized coefficients:
confint(fit, c(0))