| weighted_trajectory_variation_univariate | R Documentation |
Calculation of the scaled/weighted average variation of the C trajectories with respect to their individual sub-posterior means
weighted_trajectory_variation_univariate( x_samples, normalised_weights, sub_posterior_means, precondition_values )
sub_posterior_means |
vector of length C of sub-posterior means |
precondition_values |
precondition values associated to each sub-posterior |
list |
where x_samples[[i]] ith collection of the C trajectories |
the approximated expectation of nu_j
# x_samples has 5 samples and C=4
N <- 10
C <- 4
x_samples <- lapply(1:N, function(i) rnorm(C))
normalised_weights <- rep(1/N, N)
sub_posterior_means <- rnorm(C)
precond <- 1:C
weighted_trajectory_variation_univariate(x_samples = x_samples,
normalised_weights = normalised_weights,
sub_posterior_means = sub_posterior_means,
precondition_values = precond)
# should be equal to the result of this:
sum(sapply(1:N, function(i) {
sum((((x_samples[[i]]-sub_posterior_means)^2)/precond))/C
}))/N
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.