Skip to content

sample_to_quantile.numeric method #557

@seabbs

Description

@seabbs

In this code:

n <- length(observed)
N <- length(predicted) / n
we convert from a sample format to a quantile format so that we can use the data.frame sample_to_quantile. It would be better if we instead had a helper function to do this.

Reproduced here:

  assert_input_sample(observed, predicted)
  assert_number(range)
  necessary_quantiles <- c((100 - range) / 2, 100 - (100 - range) / 2) / 100

  # this could be its own function, sample_to_quantile.numeric
  # ==========================================================
  n <- length(observed)
  N <- length(predicted) / n
  dt <- data.table(
    observed = rep(observed, each = N),
    predicted = as.vector(t(predicted))
  )
  quantile_dt <- sample_to_quantile(dt, necessary_quantiles)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions