Skip to contents

Statistics over the trajectories of an EnsembleProblem() solution, as SciMLBase's EnsembleAnalysis. get_timestep(sim, i) is the list of the ith saved states and get_timepoint(sim, t) of the states at time t; componentwise_vectors_timestep() and componentwise_vectors_timepoint() regroup them by component.

Usage

get_timestep(sim, i)

get_timepoint(sim, t)

componentwise_vectors_timestep(sim, i)

componentwise_vectors_timepoint(sim, t)

componentwise_mean(A)

componentwise_meanvar(A, bessel = TRUE)

componentwise_meancov(A, B, bessel = TRUE)

componentwise_meancor(A, B, bessel = TRUE)

componentwise_weighted_meancov(
  A,
  B,
  W,
  weight_type = c("reliability", "frequency", "population")
)

timestep_mean(sim, i)

timestep_median(sim, i)

timestep_quantile(sim, q, i)

timestep_meanvar(sim, i)

timestep_meancov(sim, i, j)

timestep_meancor(sim, i, j)

timestep_weighted_meancov(sim, W, i, j)

timepoint_mean(sim, t)

timepoint_median(sim, t)

timepoint_quantile(sim, q, t)

timepoint_meanvar(sim, t)

timepoint_meancov(sim, t1, t2)

timepoint_meancor(sim, t1, t2)

timepoint_weighted_meancov(sim, W, t1, t2)

timeseries_steps_mean(sim)

timeseries_steps_median(sim)

timeseries_steps_quantile(sim, q)

timeseries_steps_meanvar(sim)

timeseries_steps_meancov(sim)

timeseries_steps_meancor(sim)

timeseries_steps_weighted_meancov(sim, W)

timeseries_point_mean(sim, ts)

timeseries_point_median(sim, ts)

timeseries_point_quantile(sim, q, ts)

timeseries_point_meanvar(sim, ts)

timeseries_point_meancov(sim, ts1, ts2 = ts1)

timeseries_point_meancor(sim, ts1, ts2 = ts1)

timeseries_point_weighted_meancov(sim, W, ts1, ts2 = ts1)

Arguments

sim

An EnsembleSolution of solutions.

i, j

Saved step indices.

t, t1, t2

Times.

A, B

Lists of observations (numeric vectors of the same length).

bessel

Use the sample (n - 1) denominator.

W

Weights, one per trajectory.

weight_type

How weights enter the covariance.

q

A quantile level.

ts, ts1, ts2

Vectors of times.

Value

See Details.

Details

  • At a saved step i: timestep_mean, timestep_median, timestep_quantile(sim, q, i), timestep_meanvar, and between steps i and j timestep_meancov, timestep_meancor, timestep_weighted_meancov(sim, W, i, j) (W one weight per trajectory).

  • At a time t (solutions are interpolated): the timepoint_ versions.

  • Along all saved steps (the steps of the first trajectory): timeseries_steps_mean, _median, _quantile, _meanvar, _meancov, _meancor, _weighted_meancov.

  • Along times ts: the timeseries_point_ versions.

  • On lists of observations: componentwise_mean(A), componentwise_meanvar(A, bessel), componentwise_meancov(A, B, bessel), componentwise_meancor(A, B, bessel) and componentwise_weighted_meancov(A, B, W, weight_type) with weight_type one of "reliability", "frequency", "population".

Mean and variance are returned as list(mean, var), covariances as list(meanx, meany, cov). The series functions return list(t, u) with one row of u per time (two of them for mean and variance); the covariance series return matrices of such lists, entry (i, j) for steps (or times) i and j.

Examples

prob <- SDEProblem(function(u, p, t) u, function(u, p, t) 0.2 * u, 1, c(0, 1))
sim <- solve(EnsembleProblem(prob), EM(), trajectories = 20, dt = 0.1, seed = 1)
timepoint_meanvar(sim, 0.5)
#> $mean
#> [1] 1.599971
#> 
#> $var
#> [1] 0.03512441
#> 
componentwise_meanvar(list(c(1, 2), c(3, 4)))
#> $mean
#> [1] 2 3
#> 
#> $var
#> [1] 2 2
#>