public class Multinomial extends UPFunctionModel
'k'
, from a number of trials 'n'
to a Vector of 'k' frequencies that sum to 'n'.
The fully parameterised model is Multinomial.M
.
For example, if Party = {Lib, NP, Lab, Green} then k=4.
An opinion poll, say, samples n people (trials) getting four frequencies
that add up to n. Given a data-set of several opinion polls
(possibly with different values for n) a fully parameterised
Multinomial.M can be estimated. The latter FunctionModel returns the
probability of a set frequencies, such as {350, 100, 400, 150}, given
n = 1000, say. Also see MultiState
.Modifier and Type | Class and Description |
---|---|
class |
Multinomial.M
|
UPFunctionModel.Est, UPFunctionModel.K
UPModel.Transform
Function.Native.WithInverse
Function.Cts2Cts, Function.Cts2Cts2Cts, Function.CtsD2CtsD, Function.HasInverse, Function.Native, Function.Native2, Function.Native3
Value.Atomic, Value.Bool, Value.Char, Value.Chars, Value.Cts, Value.Defer, Value.Discrete, Value.Enum, Value.Inc_Or, Value.Int, Value.Lambda, Value.List, Value.Maybe, Value.Option, Value.Real, Value.Scannable, Value.Structured, Value.Triv, Value.Tuple
Modifier and Type | Field and Description |
---|---|
int |
k
The number of categories 'k'.
|
Constructor and Description |
---|
Multinomial(Value k)
Problem definition parameter
'k' > 0
is the number of categories. |
Modifier and Type | Method and Description |
---|---|
UPFunctionModel.Est |
estimator(Value ps)
Return an Estimator of a
Multinomial.M ;
parameter 'ps' is 'triv', '( )'. |
Multinomial.M |
sp2Model(double msg1,
double msg2,
Value sp)
Given two-part message lengths, msg1 and msg2, and statistical
parameter(s), sp, return a fully parameterised
Function
Model . |
Value |
stats(boolean add,
Value ss0,
Value ss1)
Combine sufficient statisticses 'ss0' and 'ss1' additively
(add=true), or remove ss1 from ss0 (add=false).
|
Value |
stats(Vector ds,
int lo,
int hi)
Stats 'ss' is just the data-set ds[lo,hi).
|
apply
public Value stats(Vector ds, int lo, int hi)
public Value stats(boolean add, Value ss0, Value ss1)
UPModel
stats(ds,lo,hi)
.public Multinomial.M sp2Model(double msg1, double msg2, Value sp)
UPFunctionModel
Model
.sp2Model
in class UPFunctionModel
public UPFunctionModel.Est estimator(Value ps)
Multinomial.M
;
parameter 'ps' is 'triv', '( )'.