pred_S3VS_GLM.Rdpred_S3VS performs prediction using predictors selected by S3VS in survival models.
pred_S3VS_GLM(y, X, method = c("NLP", "LASSO"))Response. A numeric/integer/logical vector with values in {0,1}.
Predictor matrix. This should include predictors selected by S3VS. Can be a base matrix or something as.matrix() can coerce. No missing values are allowed.
Character string indicating the prediction method used. Available options are "NLP", "LASSO".
A list containing:
Predicted response
Coefficient estimates of the predictors used for prediction
# Simulate binary data
set.seed(123)
n <- 100
p <- 150
X <- matrix(rnorm(n * p), n, p)
colnames(X) <- paste0("V", 1:p)
eta <- X[,1] + 0.5 * X[,2]
prob <- 1 / (1 + exp(-eta))
y <- rbinom(n, size = 1, prob = prob)
# Predict
pred_glm <- pred_S3VS_GLM(y = y, X = X[,1:3], method = "LASSO")
pred_glm
#> $coef
#> V1 V2 V3
#> 0.06191237 0.00000000 0.00000000
#>
#> $y.pred
#> lambda.1se
#> [1,] 0.5400470
#> [2,] 0.5451223
#> [3,] 0.5724210
#> [4,] 0.5497344
#> [5,] 0.5506350
#> [6,] 0.5747886
#> [7,] 0.5557099
#> [8,] 0.5291941
#> [9,] 0.5381029
#> [10,] 0.5418122
#> [11,] 0.5673428
#> [12,] 0.5541639
#> [13,] 0.5547904
#> [14,] 0.5503500
#> [15,] 0.5401183
#> [16,] 0.5758755
#> [17,] 0.5562744
#> [18,] 0.5183603
#> [19,] 0.5593821
#> [20,] 0.5413952
#> [21,] 0.5322354
#> [22,] 0.5453096
#> [23,] 0.5328800
#> [24,] 0.5374559
#> [25,] 0.5390539
#> [26,] 0.5226857
#> [27,] 0.5614630
#> [28,] 0.5510040
#> [29,] 0.5311515
#> [30,] 0.5677946
#> [31,] 0.5551832
#> [32,] 0.5441258
#> [33,] 0.5623369
#> [34,] 0.5620780
#> [35,] 0.5612159
#> [36,] 0.5591881
#> [37,] 0.5571311
#> [38,] 0.5477043
#> [39,] 0.5439586
#> [40,] 0.5428140
#> [41,] 0.5379820
#> [42,] 0.5454640
#> [43,] 0.5291889
#> [44,] 0.5816420
#> [45,] 0.5670978
#> [46,] 0.5313832
#> [47,] 0.5424696
#> [48,] 0.5414895
#> [49,] 0.5605814
#> [50,] 0.5473751
#> [51,] 0.5525344
#> [52,] 0.5482159
#> [53,] 0.5479963
#> [54,] 0.5695378
#> [55,] 0.5451899
#> [56,] 0.5717808
#> [57,] 0.5248159
#> [58,] 0.5575999
#> [59,] 0.5505518
#> [60,] 0.5519622
#> [61,] 0.5544672
#> [62,] 0.5409412
#> [63,] 0.5435401
#> [64,] 0.5329945
#> [65,] 0.5321743
#> [66,] 0.5533028
#> [67,] 0.5555157
#> [68,] 0.5494661
#> [69,] 0.5627504
#> [70,] 0.5798501
#> [71,] 0.5411148
#> [72,] 0.5130636
#> [73,] 0.5640216
#> [74,] 0.5377590
#> [75,] 0.5380851
#> [76,] 0.5643235
#> [77,] 0.5442840
#> [78,] 0.5298781
#> [79,] 0.5514318
#> [80,] 0.5465233
#> [81,] 0.5487420
#> [82,] 0.5545534
#> [83,] 0.5429647
#> [84,] 0.5585125
#> [85,] 0.5452710
#> [86,] 0.5537351
#> [87,] 0.5654081
#> [88,] 0.5553165
#> [89,] 0.5436519
#> [90,] 0.5661985
#> [91,] 0.5638354
#> [92,] 0.5570467
#> [93,] 0.5523111
#> [94,] 0.5390098
#> [95,] 0.5694171
#> [96,] 0.5394351
#> [97,] 0.5819188
#> [98,] 0.5720255
#> [99,] 0.5450375
#> [100,] 0.5328735
#>