Learn R Programming

OpasnetUtils (version 1.3)

CollapseMarginal: Collapse marginals

Description

Apply functions (only sample at the moment) over ovaribale indices

Usage

CollapseMarginal(variable, cols, fun = "mean", probs = NULL, ...)

Arguments

variable

an ovariable

cols

vector of column names or indices to collapse

fun

character name of function to be used to summarize

probs

list of vectors defining the distribution of values in a column index

excess arguments are ignored

Value

Input ovariable with possibly lighter output.

Details

Samples over a fully defined column index (marginal) treating it as a nuisance parameter. Increases the joint distribution uncertainty (loses information). Weighted sampling is also possible.

Used to streamline heavy models (output has fewer rows of data).

See also: http://en.opasnet.org/

Examples

Run this code
test <- Ovariable("test", output = data.frame(City = c("Helsinki", "Espoo"), 
    Iter = 1, testResult = 1:2), marginal = c(TRUE, TRUE, FALSE))
CollapseMarginal(test, "City", "mean")

Run the code above in your browser using DataLab