#Convert infert dataset to Cyclops format:
covariates <- data.frame(stratumId = rep(infert$stratum, 2),
rowId = rep(1:nrow(infert), 2),
covariateId = rep(1:2, each = nrow(infert)),
covariateValue = c(infert$spontaneous, infert$induced))
outcomes <- data.frame(stratumId = infert$stratum,
rowId = 1:nrow(infert),
y = infert$case)
#Make sparse:
covariates <- covariates[covariates$covariateValue != 0, ]
#Create Cyclops data object:
cyclopsData <- convertToCyclopsData(outcomes, covariates, modelType = "clr",
addIntercept = FALSE)
#Fit model:
fit <- fitCyclopsModel(cyclopsData, prior = createPrior("none"))
Run the code above in your browser using DataLab