bvd | R Documentation |
Decompose the prediction error (mean-squared error) into bias and variance components
bvd(preds, obs)
preds |
A vector of predicted probabilities. |
obs |
A vector containing the observed binary outcomes (0 or 1). |
'bias' given by
\frac{1}{N} \sum (\frac{1}{N} \sum(\hat y)) - y)^2
'variance' given by
\frac{1}{N} \sum (\frac{1}{N} \sum(\hat y)) - \hat y)^2
# Generate some predictions
predictions <- runif(1000)
# Generate some binary outcomes
observations <- sample(0:1, size = 1000, replace = TRUE)
# Calculate the bias and variance
bvd(predictions, observations)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.