readCyclopsData {Cyclops}R Documentation

Read Cyclops data from file


readCyclopsData reads a Cyclops-formatted text file.


readCyclopsData(fileName, modelType)



Name of text file to be read. If fileName does not contain an absolute path,


character string: Valid types are listed below.


This function reads a Cyclops-formatted text file and returns a Cyclops data object. The first line of the file may start with '‘⁠#⁠’', indicating that it contains header options. Valid header options are:

⁠ row_label⁠ (assume file contains a numeric column of unique row identifiers)
⁠ stratum_label⁠ (assume file contains a numeric column of stratum identifiers)
⁠ weight⁠ (assume file contains a column of row-specific model weights, currently unused)
⁠ offset⁠ (assume file contains a dense column of linear predictor offsets)
⁠ bbr_outcome⁠ (assume logistic outcomes are encoded -1/+1 following BBR)
⁠ log_offset⁠ (assume file contains a dense column of values x_i for which log(x_i) is the offset)
⁠ add_intercept⁠ (automatically include an intercept column of all 1s for each entry)
⁠ indicator_only⁠(assume all covariates 0/1-valued and only covariate name is given)
⁠ sparse⁠ (force all BBR formatted covariates to be represented as sparse, instead of
sparse-indicator, columns .. really only for debugging)
⁠ dense⁠ (force all BBR formatted covariates to be represented as dense columns.. really
only for debugging)

Successive lines of the file are white-space delimited and follow the format:

	[Row ID] {Stratum ID} [Weight] <Outcome> {Censored} {Offset} <BBR covariates>

Bayesian binary regression (BBR) covariates are white-space delimited and generally in a sparse ‘⁠<name>:<value>⁠’ format, where ‘⁠name⁠’ must (currently) be numeric and ‘⁠value⁠’ is non-zero. If option ‘⁠indicator_only⁠’ is specified, then format is simply ‘⁠<name>⁠’. ‘⁠Row ID⁠’ and ‘⁠Stratum ID⁠’ must be numeric, and rows must be sorted such that equal ‘⁠Stratum ID⁠’ are consecutive. ‘⁠Stratum ID⁠’ is required for ‘⁠clr⁠’ and ‘⁠sccs⁠’ models. ‘⁠Censored⁠’ is required for a ‘⁠cox⁠’ model. ‘⁠Offset⁠’ is (currently) required for a ‘⁠sccs⁠’ model.


A list that contains a Cyclops model data object pointer and an operation duration


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


## Not run: 
dataPtr = readCyclopsData(system.file("extdata/infert_ccd.txt", package="Cyclops"), "clr")

## End(Not run)

[Package Cyclops version 3.4.1 Index]