pred_sens {NeuralNetTools}R Documentation

Predicted values for Lek profile method

Description

Get predicted values for Lek Profile method, used iteratively in lekprofile

Usage

pred_sens(mat_in, mod_in, var_sel, step_val, grps, ysel)

Arguments

mat_in

data.frame of only the explanatory variables used to create model

mod_in

any model object with a predict method

var_sel

chr string of explanatory variable to select

step_val

number of values to sequence range of selected explanatory variable

grps

matrix of values for holding explanatory values constant, one column per variable and one row per group

ysel

chr string of response variable names for correct labelling

Details

Gets predicted output for a model's response variable based on matrix of explanatory variables that are restricted following Lek's profile method. The selected explanatory variable is sequenced across a range of values. All other explanatory variables are held constant at the values in grps.

Value

A list of predictions where each element is a data.frame with the predicted value of the response and the values of the explanatory variable defined by var_sel. Each element of the list corresponds to a group defined by the rows in grps at which the other explanatory variables were held constant.

See Also

lekprofile

Examples


## using nnet

library(nnet)

data(neuraldat) 
set.seed(123)

mod <- nnet(Y1 ~ X1 + X2 + X3, data = neuraldat, size = 5)

mat_in <- neuraldat[, c('X1', 'X2', 'X3')]
grps <- apply(mat_in, 2, quantile, seq(0, 1, by = 0.2))

pred_sens(mat_in, mod, 'X1', 100, grps, 'Y1')

[Package NeuralNetTools version 1.5.3 Index]