Learn R Programming

msaenet (version 3.1.2)

msaenet.tp: Get the Number of True Positive Selections

Description

Get the number of true positive selections from msaenet model objects, given the indices of true variables (if known).

Usage

msaenet.tp(object, true.idx)

Value

Number of true positive variables in the model.

Arguments

object

An object of class msaenet produced by aenet, amnet, asnet, msaenet, msamnet, or msasnet.

true.idx

Vector. Indices of true variables.

Author

Nan Xiao <https://nanx.me>

Examples

Run this code
dat <- msaenet.sim.gaussian(
  n = 150, p = 500, rho = 0.6,
  coef = rep(1, 5), snr = 2, p.train = 0.7,
  seed = 1001
)

msaenet.fit <- msaenet(
  dat$x.tr, dat$y.tr,
  alphas = seq(0.2, 0.8, 0.2),
  nsteps = 3L, seed = 1003
)

msaenet.tp(msaenet.fit, 1:5)

Run the code above in your browser using DataLab