Skip to content

Uncertain index dataset

UncertainIndexDatasets is an uncertain dataset type that represents the indices corresponding to an UncertainValueDataset.

It is meant to be used for the indices field in UncertainIndexValueDatasets instances.

Documentation

# UncertainData.UncertainDatasets.UncertainIndexDatasetType.

1
UncertainIndices

Generic dataset containing uncertain indices.

Fields

  • indices::AbstractVector{AbstractUncertainValue}: The uncertain values.

source

Examples

Example 1: increasing index uncertainty through time

Defining the indices

Say we had a dataset of 20 values for which the uncertainties are normally distributed with increasing standard deviation through time.

1
2
3
time_inds = 1:13
uvals = [UncertainValue(Normal, ind, rand(Uniform()) + (ind / 6)) for ind in time_inds]
inds = UncertainIndexDataset(uvals)

Let's plot the 33rd to 67th percentile range for the indices:

1
plot(inds, [0.33, 0.67])

Defining the data

Let's define some uncertain values that are associated with the indices.

1
2
3
4
5
6
u1 = UncertainValue(Gamma, rand(Gamma(), 500))
u2 = UncertainValue(rand(MixtureModel([Normal(1, 0.3), Normal(0.1, 0.1)]), 500))
uvals3 = [UncertainValue(Normal, rand(), rand()) for i = 1:11]

measurements = [u1; u2; uvals3]
datavals = UncertainValueDataset(measurements)

Combinining the indices and values

Now, we combine the indices and the corresponding data.

1
d = UncertainIndexDataset(inds, datavals)

Plot the dataset with error bars in both directions, using the 20th to 80th percentile range for the indices and the 33rd to 67th percentile range for the data values.

1
plot(d, [0.2, 0.8], [0.33, 0.67])