Description Usage Arguments Details Value References
This function computes training error, in-sample error, and optimism in MC simulation setting.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | compute_insample(
data,
ny,
fit,
rand,
mcname = "mc",
xname = "x",
yname = "y",
fitname = "fx",
pred_name = "pred",
insample_name = "y",
error = c("squared", "absolute"),
distribution = FALSE,
mod,
formula,
...
)
|
data |
MC data set generated by |
ny |
the number of response at each x point |
fit |
True model function with |
rand |
Random sample generator function for error term. By default, rnorm |
mcname |
column name of the MC sample. By default, |
xname |
column name of the data. By default, |
yname |
column name of the response. By default, |
fitname |
column name of the true fit. By default, |
pred_name |
column name of the predicted values. By default, |
insample_name |
multiple column names when computing insample error |
error |
Choice of loss function. See |
distribution |
return the error for each MC sample? |
mod |
Model function. |
formula |
an object of class formula. |
... |
Additional arguments for |
In-sample error differs from Expected test error in that it is computed in the same predictor values. Instead, it uses new response values at each predictor point.
Err_{in} = \frac{1}{N} ∑_{i = 1}^N E_{y_0} [L(Y_i^{(0)}, \hat{f}(x_i)) \mid T]
Optimism is the difference between the insample error and the training error.
Training error, Insample error, Optimism
Hastie, T., Tibshirani, R.,, Friedman, J. (2001). The Elements of Statistical Learning. New York, NY, USA: Springer New York Inc..
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.