createCyclopsData {Cyclops} | R Documentation |
Create a Cyclops data object
Description
createCyclopsData
creates a Cyclops data object from an R formula or data matrices.
Usage
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"
)
Arguments
formula |
An object of class |
sparseFormula |
An object of class |
indicatorFormula |
An object of class |
modelType |
character string: Valid types are listed below. |
data |
An optional data frame, list or environment containing the variables in the model. |
subset |
Currently unused |
weights |
Currently unused |
censorWeights |
Vector of subject-specific censoring weights (between 0 and 1). Currently only supported in |
offset |
Currently unused |
time |
Currently undocumented |
pid |
Optional vector of integer stratum identifiers. If supplied, all rows must be sorted by increasing identifiers |
y |
Currently undocumented |
type |
Currently undocumented |
dx |
Optional dense |
sx |
Optional sparse |
ix |
Optional {0,1} |
model |
Currently undocumented |
normalize |
String: Name of normalization for all non-indicator covariates (possible values: stdev, max, median) |
floatingPoint |
Integer: Floating-point representation size (32 or 64) |
method |
Currently undocumented |
Details
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 necessarywhen
"time"
are necessary
Value
A list that contains a Cyclops model data object pointer and an operation duration
Models
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 |
Examples
## 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)
cyclopsFit2 <- fitCyclopsModel(cyclopsData2)