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 "formula" that provides a symbolic description of the numerically dense model response and terms.

sparseFormula

An object of class "formula" that provides a symbolic description of numerically sparse model terms.

indicatorFormula

An object of class "formula" that provides a symbolic description of {0,1} model terms.

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 modelType = "fgr".

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 "Matrix" of covariates

sx

Optional sparse "Matrix" of covariates

ix

Optional {0,1} "Matrix" of covariates

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:

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)


[Package Cyclops version 3.4.1 Index]