Learn R Programming

holiglm (version 1.0.1)

as.OP.hglm_model: Convert to OP

Description

Convert an object of class "hglm_model" into a ROI optimization problem (OP).

Usage

# S3 method for hglm_model
as.OP(x)

Value

A ROI object of class "OP".

Arguments

x

an object inheriting from "hglm_model".

Details

This function is mainly for internal use and advanced users which want of alter the model object or the underlying optimization problem. This function converts the model object created by hglm_model into a conic optimization problem solveable via ROI_solve.

Examples

Run this code
dat <- rhglm(100, c(1, 2, -3, 4, 5, -6))
# Use hglm with option dry_run
model <- hglm(y ~ ., data = dat, dry_run = TRUE)
op <- as.OP(model)
# User hglm_model
x <- model.matrix(y ~ ., data = dat)
model <- hglm_model(x, dat[["y"]])
op <- as.OP(model)

Run the code above in your browser using DataLab