# Preprocess a ksvm object

### Description

Performs necessary preprocessing of a `ksvm`

object when the plots should be generated based on all training data and not only on the support vectors.

### Usage

1 2 | ```
preplotperf(model, mydata, indy, mytestdata, zerolevel = "zero",
risklabel = "Estimated risk", adverse = FALSE)
``` |

### Arguments

`model` |
Object of class |

`mydata` |
Data on which |

`indy` |
Column number of the outcome in |

`mytestdata` |
Data on which to evaluate |

`zerolevel` |
The value of the contributions that should be put to zero. If "zero", the contributions are represented as they are. If "min", for each predictor or set of predictors contributing to an interaction, the minimal observed value of the contribution in the training data is substracted from the contribution to ensure that the contribution is always positive. If "median" or "mean", the median or mean value is substracted from the contributions, respectively (default="zero"). See below for more details. |

`risklabel` |
A character string representing the label for the represented risk. For multinomial logistic regression models, a vector of risk labels should be provided. See the examples for an illustration of the approach. |

`adverse` |
A logical indicating whether the score and risk range in the adverse direction (default=FALSE, i.e. high score corresponds to a high risk). |

### Details

Depending on the value of `zerolevel`

, the visualized contributions are slightly different.
If `zerolevel`

="zero", the contribution for variable *x^p* is *β_pf_p(x^p)*, with *β_p* the model
coefficient corresponding to this predictor and *f_p(x^p)* a (possible) transformation of *x^p*. If `zerolevel`

is "min", "median" or "mean", a value equal to
the minimum, median and mean of the contribution *β_pf_p(x^p)* in the training data, respectively, is substracted from the contribution. See the references for more information.

### Value

List object

### Author(s)

Vanya Van Belle

### References

Van Belle V., Van Calster B., Suykens J.A.K., Van Huffel S. and Lisboa P., *Explaining support vector machines: a color based nomogram*, Internal Report 16-27, ESAT-Stadius, KU Leuven (Leuven, Belgium), 2016

### See Also

`colplot`

, `cchart`

, `ccchart`