Description Usage Arguments Details Value Author(s) See Also Examples

This function computes accuracy measures for predicted numerical or binary responses.

1 |

`pred` |
Vector or matrix of predicted responses. Each column corresponds to a different lambda value |

`obs` |
Vector or observed binary responses |

`type` |
Type of prediction model |

`verbose` |
logical, defaults to |

`prednames` |
Optional vector of names for the different sets of predictions |

For linear regression, the function simply returns the root mean square error (RMSE) of the predicted responses. For logistic regression, the function computes the negative log-likelihood using the original vector `pred`

whose values should be in $(0,1)$ (soft classification). For the purpose of hard classification, the function also converts
this vector to binary values and computes the following classification measures: sensitivity a.k.a. true positive rate (TP/(TP+FN)), specificity a.k.a. true negative rate (TN/(FP+TN)), accuracy (TP+TN)/(TP+TN+FP+FN), and precision a.k.a. positive predictive value (TP/(TP+FP)). Two cutoff values are considered for the binary conversion: 0.5 and the proportion of 1's in `obs`

.

If `type="linear"`

, the RMSE of the predictions.

If `type="logit"`

, a list with components

`prior` |
proportion of 1's in |

`ll` |
negative log-likelihoods |

`classif` |
classification measures for the cutoff value 0.5 |

`classif.adj` |
classification measures for the adjusted cutoff value |

David Degras

`creSGL`

, `predictSGL`

, `runPredictions`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
n = 50; p = 100; size.groups = 10
index <- ceiling(1:p / size.groups)
X = matrix(rnorm(n * p), ncol = p, nrow = n)
beta = (-2:2)
y = X[,1:5] %*% beta + 0.1*rnorm(n)
y = ifelse((exp(y) / (1 + exp(y))) > 0.5, 1, 0)
data = list(x = X, y = y)
weights = rep(1, size.groups)
fit = creSGL(data, index, weights, type = "linear", maxit = 1000, thresh = 0.001,
min.frac = 0.05, nlam = 100, gamma = 0.8, standardize = TRUE, verbose = FALSE,
step = 1, reset = 10, alpha = 0.05, lambdas = NULL)
pred = predict(Fit, X, 5)
prednames = substr(fit$lambdas,1,4)
accuracy(pred, y, type="logit", prednames=prednames)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.