mse | R Documentation |
Calculation and plotting of prediction error rates (RMSEP, SEP, etc. or classification error rate) for models with quantitative or qualitative responses.
Note: In function mse
, The R2
rate is calculated by R2 = 1 - MSEP(fitted model) / MSEP(no model)
, where MSEP = Sum((y_i - fit_i)^2)/n
and "no model" is the overall mean of y
. For predictions over CV or Test sets, and/or for non linear models, it can be different from the square of the correlation coefficient between the observed values and prediction.
See examples in plsr
, plsda
, etc.
mse(fm, formula = ~ 1, nam = NULL, digits = 3)
err(fm, formula = ~ 1, nam = NULL, digits = 4)
plotmse(obj, namx = "ncomp", nam = "msep", group = NULL, col = NULL,
legend = TRUE, legend.title = NULL, ncol = 1, ...)
fm |
An object containing at least data frames |
formula |
A right-hand-side formula defing the aggregation levels on which are calculated the error rates. |
namx |
For |
nam |
For |
digits |
The number of digits for the numerical outputs. |
Arguments specific to plotmse
:
obj |
Data frame returned by |
group |
A vector of length equal to the number of rows of |
col |
A color, or a vector of colors (of length equal to the number of groups), defining the color(s) of the lines representing the error rates. |
legend |
Only if there are groups. Logical indicationg is a legend is drawn for groups (Default to |
legend.title |
Character string indicationg a title for the legend. |
ncol |
Number of columns drawn in the legend box. |
... |
Other arguments to pass in functions |
.
A dataframe.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.