66\title {Increment and decrement operators }
77\description {
88 Syntactic sugar for incrementing and decrementing likelihood functions.
9-
10- Frankly they don ' t do anything that \c ode{magrittr:add()} and
11- \c ode{magrittr:subtract()} don' t (except have a default value of 1
12- (which is surprisingly useful ).
13-
9+ Useful for constructs such as \code {H [c(" a" , " b" )] \%<> \% inc()}.
1410}
1511\usage {
1612inc(H , val = 1 )
1713dec(H , val = 1 )
1814}
1915\arguments {
2016 \item {H }{A hyper2 object }
21- \item {winners , players }{Numeric or character vectors specifying the
22- winning team and the losing team }
2317 \item {val }{Numeric }
2418}
2519\details {
@@ -28,8 +22,8 @@ A very frequent operation is to increment a single term in a
2822\code {hyper2 } object. If
2923
3024\preformatted {
31- > H <- hyper2(list (" a" ,c(" a" ," b" )," c" ,c(" a" ," b" ," c" )),c(1 : 3 ,- 6 ))
32- > H
25+ > H <- hyper2(list (" a" , c(" a" ," b" ), " c" , c(" a" ," b" ," c" )), c(1 : 3 ,- 6 ))
26+ > H
3327log( a * (a + b + c )^- 6 * b ^ 2 * c ^ 3 )
3428}
3529
@@ -61,46 +55,31 @@ but other values can be supplied:
6155H [c(" a" ," b" )] \%<> \% inc(3 )
6256}
6357
64-
6558Or even
6659
6760\preformatted {
6861H [c(" a" ," b" )] \%<> \% inc(H [" a" ])
6962}
7063
64+ The deprecated convenience function \code {trial()} uses this idiom ; see
65+ \code {pick.Rd }. Using \code {trial()} in this way ensures that the
66+ powers sum to zero (unlike \code {inc()} and \code {dec()}.
7167
72- The convenience function \code {trial()} takes this one step further and
73- increments the \sQuote {winning team } and decrements the bracket
74- containing all players. The winners are expected to be players.
68+ The \code {inc } and \code {dec } operators and the \code {pick()} function
69+ are used in \code {inst / kka.Rmd }.
7570
76- \preformatted {
77- > trial(c(" a" ," b" ),c(" a" ," b" ," c" ))
78- > (a + b ) * (a + b + c )^- 1
79- }
80-
81- Using \code {trial()} in this way ensures that the powers sum to zero.
82-
83-
84- \preformatted {
85- H <- trial(c(" a" ," b" ),c(" a" ," b" ," c" ))
86- H \%<> \% inc(trial(" a" ,c(" a" ," b" )))
87- H
88- }
89-
90- The \code {inc } and \code {dec } operators and the \code {trial()}
91- function are used in \code {inst / kka.Rmd }.
71+ Frankly \code {inc()} and \code {dec()} don ' t do anything that
72+ \c ode{magrittr:add()} and \c ode{magrittr:subtract()} don' t (except have
73+ a default value of 1 (which is surprisingly useful )).
9274
9375}
9476\author {Robin K. S. Hankin }
9577\examples {
96- data(chess )
97-
98- # # Now suppose we observe an additional match, in which Topalov beats
99- # # Anand. To incorporate this observation into the LF:
100-
101-
10278
103- trial(" a" ,c(" a" ," b" ))
79+ (H <- hyper2(list (" a" ,c(" a" ," b" ),c(" a" ," b" ," c" )),c(1 ,1 ,- 2 )))
80+ H [" a" ] %<> % inc
81+ H [c(" a" ," x" )] %<> % dec
82+ H
83+ cd
10484
105- chess <- chess + trial(" Topalov" ,c(" Topalov" ," Anand" ))
10685}
0 commit comments