Description Usage Arguments Details Value Author(s) Examples

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.

1 2 3 4 5 6 7 | ```
## 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)
hyper2_sum_numeric(H,r)
``` |

`e1,e2` |
Objects of class |

`x,...,na.rm` |
In the |

`H,r` |
In function |

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.

Function `hyper2_sum_numeric()`

is defined so that idiom like

`H[p] <- H[p] + 3`

works (without this, one has to type `H[p] <- powers(H[p]) + 3`

,
which sucks).

Returns a `hyper2`

object or a Boolean.

Robin K. S. Hankin

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ```
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
n <- 4
H <- hyper2(d=n)
for(i in seq_len(30)){
jj <- sample(seq_len(n),sample(n,1),replace=FALSE)
H[jj] <- H[jj] + 1
}
## without pnames:
x1 <- hyper2(list(1,1:2,1:3),1:3)
x2 <- hyper2(list(4,5),10:11)
x1+x2
## Same as above, but with pnames:
y1 <- hyper2(list(1,1:2,1:3),1:3,pnames=letters[1:3])
y2 <- hyper2(list(4,5),10:11,pnames=letters[1:5])
## Not run: y1+y2 # fails, pnames not identical
pnames(y1) <- letters[1:5]
y1+y2
``` |

hyper2 documentation built on Aug. 10, 2018, 1:15 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.