predict.sgs {sgs} | R Documentation |
Predict using one of the following object types: "sgs"
, "sgs_cv"
, "gslope"
, "gslope_cv"
.
Description
Performs prediction from one of the following fits: fit_sgs()
, fit_sgs_cv()
, fit_gslope()
, fit_gslope_cv()
. The predictions are calculated for each "lambda"
value in the path.
Usage
## S3 method for class 'sgs'
predict(object, x, ...)
Arguments
object |
Object of one of the following classes: |
x |
Input data to use for prediction. |
... |
further arguments passed to stats function. |
Value
A list containing:
response |
The predicted response. In the logistic case, this represents the predicted class probabilities. |
class |
The predicted class assignments. Only returned if type = "logistic" in the |
See Also
fit_sgs()
, fit_sgs_cv()
, fit_gslope()
, fit_gslope_cv()
Other SGS-methods:
as_sgs()
,
coef.sgs()
,
fit_sgs()
,
fit_sgs_cv()
,
plot.sgs()
,
print.sgs()
,
scaled_sgs()
Other gSLOPE-methods:
coef.sgs()
,
fit_gslope()
,
fit_gslope_cv()
,
plot.sgs()
,
print.sgs()
Examples
# specify a grouping structure
groups = c(1,1,1,2,2,3,3,3,4,4)
# generate data
data = gen_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)