marginals2d: marginals2d

Description Usage Arguments Value Author(s) See Also Examples

Description

integrate over all others but 2 columns

Usage

1
2
marginals2d(x, vars = c(2, 3), intCol = 1, n = round(sqrt(nrow(x))/12), 
    dimnames = .colNames(x, vars), fAgg = mean, ...)

Arguments

x

numeric matrix

vars

index (integer or string): column to define integration boxes

intCol

index (integer or string): column to average

n

numeric vector: number of groups per variable

dimnames

dimension names of the result array

fAgg

function applied over the subsets of x[,intCol]

...

further arguments to fAgg

Value

numeric matrix with each item representing application of fAgg to x[,intCol] and dimnames equal to means of the classes

Author(s)

Thomas Wutzler

See Also

marginals1d twDEMCBlockInt

Examples

1
2
3
4
5
6
7
data(twdemcEx1)
sample <- stackChains(twdemcEx1)
#res <- marginals2d(sample,vars=c("kY","kO"),n=10)
res <- marginals2d(sample,vars=c("a","b"),n=10)
    if( require(lattice) && require(reshape) ){
        levelplot( value~a*b, data=melt(res), col.regions=rev(heat.colors(100)), xlab=names(dimnames(res))[1], ylab=names(dimnames(res))[2] )
    }

twDEMC documentation built on May 2, 2019, 5:38 p.m.