predict.sgs {sgs} | R Documentation |
predict using a "sgs"
object
Description
Performs prediction from an fit_sgs()
model fit.
Usage
## S3 method for class 'sgs'
predict(object, x, ...)
Arguments
object |
an object of class |
x |
Input data to use for prediction. |
... |
further arguments passed to stats function. |
Value
A list containing:
itemresponseThe predicted response. In the logistic case, this represents the predicted class probabilities.
itemclassThe predicted class assignments. Only returned if type = "logistic" in the "sgs"
object.
See Also
Other SGS-methods:
plot.sgs_cv()
,
print.sgs()
Examples
# specify a grouping structure
groups = c(1,1,1,2,2,3,3,3,4,4)
# generate data
data = generate_toy_data(p=10, n=5, groups = groups, seed_id=3,group_sparsity=1)
# run SGS
model = fit_sgs(X = data$X, y = data$y, groups = groups, type="linear", lambda = 1, alpha=0.95,
vFDR=0.1, gFDR=0.1, standardise = "l2", intercept = TRUE, verbose=FALSE)
# use predict function
model_predictions = predict(model, x = data$X)
[Package sgs version 0.1.1 Index]