Ops.hyper2: Arithmetic Ops Group Methods for hyper2 objects

Description Usage Arguments Details Value Author(s) Examples

Description

Allows arithmetic operators “+”, “*” and comparison operators “==” and “!=”, to be used for hyper2 objects.

Specifically, H1 + H2 implements addition of two log-likelihood functions, corresponding to incorporation of new observational data; and n*H1 implements H1+H1+...+H1, corresponding to repeated observations of the same data.

There are no unary operations for this class.

Usage

1
2
3
4
5
6
## S3 method for class 'hyper2'
Ops(e1, e2 = NULL)
## S3 method for class 'hyper2'
sum(x,...,na.rm=FALSE)
hyper2_add(e1,e2)
hyper2_equality(e1,e2)

Arguments

e1,e2

Objects of class hyper2, here interpreted as hyperdirichlet distributions

x,...,na.rm

In the sum() method, objects to be summed; na.rm is currently ignored

Details

Testing for equality is not straightforward for two implementation reasons. Firstly, the object itself is stored internally as a stl map, which does not store keys in any particular order; and secondly, the stl set class is used for the brackets. A set does not include information about the order of its elements; neither does it admit repeated elements. See examples.

Value

Returns a hyper2 object or a Boolean.

Author(s)

Robin K. S. Hankin

Examples

1
2
stopifnot(hyper2(list(1,1:2),1:2)==hyper2(list(1:2,1),2:1))  # stl map class
stopifnot(hyper2(list(1,1:2),1:2)==hyper2(list(1,c(1,1,2)),1:2)) # stl set class

hyper2 documentation built on July 6, 2017, 9:02 a.m.