Description Usage Arguments Details Value Author(s) References Examples

View source: R/penaltyParameter.R

Find the best penalty parameter *C* for the generalized distance weighted discrimination (DWD) model.

1 | ```
penaltyParameter(X,y,expon,rmzeroFea = 1, scaleFea = 1)
``` |

`X` |
A |

`y` |
A vector of length |

`expon` |
A positive number representing the exponent |

`rmzeroFea` |
Switch for removing zero features in the data matrix. Default is set to be 1 (removing zero features). |

`scaleFea` |
Switch for scaling features in the data matrix. This is to make the features having roughly similar magnitude. Default is set to be 1 (scaling features). |

The best parameter is empirically found to be inversely proportional to the typical distance between different samples raised to the power of (*expon+1*).
It is also dependent on the sample size *n* and feature dimension *d*.

A number which represents the best penalty parameter for the generalized DWD model.

Xin-Yee Lam, J.S. Marron, Defeng Sun, and Kim-Chuan Toh

Lam, X.Y., Marron, J.S., Sun, D.F., and Toh, K.C. (2018)
“Fast algorithms for large scale generalized distance weighted discrimination", *Journal of Computational and Graphical Statistics*, forthcoming.

https://arxiv.org/abs/1604.05473

1 2 3 4 | ```
# load the data
data("mushrooms")
# calculate the best penalty parameter
C = penaltyParameter(mushrooms$X,mushrooms$y,expon=1)
``` |

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.