createCyclopsData
creates a Cyclops data object from an R formula or data matrices.
createCyclopsData(
formula,
sparseFormula,
indicatorFormula,
modelType,
data,
subset = NULL,
weights = NULL,
censorWeights = NULL,
offset = NULL,
time = NULL,
pid = NULL,
y = NULL,
type = NULL,
dx = NULL,
sx = NULL,
ix = NULL,
model = FALSE,
normalize = NULL,
floatingPoint = 64,
method = "cyclops.fit"
)
An object of class "formula"
that provides a symbolic description of the numerically dense model response and terms.
An object of class "formula"
that provides a symbolic description of numerically sparse model terms.
An object of class "formula"
that provides a symbolic description of {0,1} model terms.
character string: Valid types are listed below.
An optional data frame, list or environment containing the variables in the model.
Currently unused
Currently unused
Vector of subject-specific censoring weights (between 0 and 1). Currently only supported in modelType = "fgr"
.
Currently unused
Currently undocumented
Optional vector of integer stratum identifiers. If supplied, all rows must be sorted by increasing identifiers
Currently undocumented
Currently undocumented
Optional dense "Matrix"
of covariates
Optional sparse "Matrix"
of covariates
Optional {0,1} "Matrix"
of covariates
Currently undocumented
String: Name of normalization for all non-indicator covariates (possible values: stdev, max, median)
Integer: Floating-point representation size (32 or 64)
Currently undocumented
A list that contains a Cyclops model data object pointer and an operation duration
This function creates a Cyclops model data object from R "formula"
or directly from
numeric vectors and matrices to define the model response and covariates.
If specifying a model using a "formula"
, then the left-hand side define the model response and the
right-hand side defines dense covariate terms.
Objects provided with "sparseFormula"
and "indicatorFormula"
must be include left-hand side responses and terms are
coersed into sparse and indicator representations for computational efficiency.
Items to discuss:
Only use formula or (y,dx,...)
stratum() in formula
offset() in formula
when "stratum"
(renamed from pid) are necessary
when "time"
are necessary
Currently supported model types are:
"ls" | Least squares |
"pr" | Poisson regression |
"lr" | Logistic regression |
"clr" | Conditional logistic regression |
"cpr" | Conditional Poisson regression |
"sccs" | Self-controlled case series |
"cox" | Cox proportional hazards regression |
"fgr" | Fine-Gray proportional subdistribution hazards regression |
## Dobson (1990) Page 93: Randomized Controlled Trial :
counts <- c(18, 17, 15, 20, 10, 20, 25, 13, 12)
outcome <- gl(3, 1, 9)
treatment <- gl(3, 3)
cyclopsData <- createCyclopsData(
counts ~ outcome + treatment,
modelType = "pr")
cyclopsFit <- fitCyclopsModel(cyclopsData)
cyclopsData2 <- createCyclopsData(
counts ~ outcome,
indicatorFormula = ~ treatment,
modelType = "pr")
summary(cyclopsData2)
#> covariateId nzCount nzMean nzVar type
#> (Intercept) 1 9 1 0 dense
#> outcome2 2 3 1 0 dense
#> outcome3 3 3 1 0 dense
#> treatment2 4 3 1 0 indicator
#> treatment3 5 3 1 0 indicator
cyclopsFit2 <- fitCyclopsModel(cyclopsData2)