ptest: Prediction Model Function

View source: R/src.r

ptestR Documentation

Prediction Model Function

Description

This is the function that creates and evaluates the predictive model.

Usage

ptest(
  object,
  Z = Z,
  newdata = NULL,
  testZ = NULL,
  regmethod = "glm",
  methods1 = c("boot", "boot632", "cv", "repeatedcv", "LOOCV", "LGOCV")[4],
  metric = "ROC",
  number1 = 10,
  repeats1 = 5,
  params = NULL
)

Arguments

object

a matrix indicating the explanatory variable(s), or an object of class msma, which is a result of a call to msma .

Z

a vector, response variable(s) for the construction of the prediction model. The length of Z is the number of subjects for the training.

newdata

a matrix for the prediction.

testZ

a vector, response variable(s) for the prediction evaluation. The length of testZ is the number of subjects for the validation.

regmethod

a character for the name of the prediction model. This corresponds to the method argument of the train function in the caret package.

methods1

a character for the name of the evaluation method.

metric

a character for the name of summary metric to select the optimal model.

number1

a number of folds or number of resampling iterations

repeats1

a number of repeats for the repeated cross-validation

params

a data frame with possible tuning values.

Details

ptest requires the output result of msma function.

Value

object

an object of class "msma", usually, a result of a call to msma

trainout

a predictive model output from the train function in the caret package with scores computed by the msma function as predictors

scorecvroc

the training evaluation measure and values of the tuning parameters

evalmeasure

evaluation measures and information criterion for the msma model

traincnfmat

a confusion matrix in training data

predcnfmat

a confusion matrix in test data

Examples



data(baseimg)
data(diffimg)
data(mask)
data(template)
img1 = simbrain(baseimg = baseimg, diffimg = diffimg, mask=mask)
B1 = rbfunc(imagedim=img1$imagedim, seppix=2, hispec=FALSE, mask=img1$brainpos)
SB1 = basisprod(img1$S, B1)
fit111 = msma(SB1, comp=2)
predmodel = ptest(fit111, Z=img1$Z)



mand documentation built on Sept. 13, 2023, 1:06 a.m.