View source: R/dsmartr_collate.R
calc_probabilities | R Documentation |
Converts the number of times a soil class was predicted to a probability by normalising against the total number of model runs.
calc_probabilities(input = NULL, n_iterations = NULL)
input |
A vector of integers n soil classes long, where the integers refer to counts of soil classes. |
n_iterations |
Integer; the total number of model runs. |
An atomic vector of probabilities, or a vector of NA values of the same length. e.g. for 20 model runs, 0 5 8 0 becomes 0 0.25 0.4 0.
This is a helper function and not widely applicable. It is expected to
be used in concert with calc
, applied to a stack
of tabulated class counts produced by
collate
.
## Not run:
# 100 model runs, from a cell in the middle of the heronvale demo dataset
cell_19291 <- c(29, 7, 7, 7, 12, 9, 29, 29, 29, 3, 16, 15, 9, 21, 24, 2, 9,
15, 34, 9, 24, 34, 24, 34, 21, 24, 15, 15, 9, 21, 21, 7, 7, 34, 34, 15, 15,
21, 7, 30, 32, 21, 29, 21, 24, 29, 31, 12, 24, 12, 21, 15, 15, 29, 12, 7, 21,
12, 7, 34, 9, 32, 7, 7, 32, 32, 12, 34, 29, 7, 3, 15, 15, 29, 7, 3, 34, 9, 9,
33, 32, 21, 34, 29, 33, 7, 7, 31, 7, 7, 24, 21, 15, 7, 24, 29, 21, 31, 29,
15, 7)
preds_19291 <- count_predictions(cell_19291)
probs_19291 <- calc_probabilities(preds_19291)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.