Last data update: 2014.03.03

R: Sufficient statistics for the multiplicative multinomial
suffstatsR Documentation

Sufficient statistics for the multiplicative multinomial

Description

Calculate, manipulate, and display sufficient statistics of the multiplicative multinomial. Functionality for analysing datasets, and distributions specified by their parameters is given; summary and print methods are also documented here.

Usage

suffstats(y, n = NULL)
expected_suffstats(L,Y)
## S3 method for class 'suffstats'
print(x, ...)
## S3 method for class 'suffstats'
summary(object, ...)
## S3 method for class 'summary.suffstats'
print(x, ...)

Arguments

y,n

In function suffstats(), argument y is a matrix with each row being a possible observation and n is counts of observations corresponding to rows of y with default NULL interpreted as each row of y being observed once. If y is an object of class gunter, this is interpreted sensibly

L,Y

In function expected_suffstats(), argument L is an object of class Lindsey [typically returned by function Lindsey()], and Y is the known constant sum (ie the rowSums() of the observations)

x, object

An object of class suffstats or summary.suffstats, to be printed or summarized

...

Further arguments to the print or summary methods. Currently ignored

Details

Function suffstats() returns a list comprising a set of sufficient statistics for the observations y,[n].

This function requires that the rowsums of y are all identical.

Value

Function suffstats() returns a list of four components:

Y

Rowsums of y

nobs

Number of observations

row_sums

Column sums of y, counted with multiplicity

cross_prods

Matrix of summed squares

Function summary.suffstats() provides a summary of a suffstats object that is a list with two elements: row_sums and cross_prods, normalized with nobs and Y so that the values are comparable with that returned by expected_suffstats(). In particular, the sum of row_sums is the known sum y.

Author(s)

Robin Hankin and P. M. E. Altham

Examples

data(voting)
suffstats(voting, voting_tally)

data(wilson)
wilson <- gunter(non_met)
suffstats(wilson)

L <- Lindsey(wilson)

expected_suffstats(L,5)
summary(suffstats(wilson))  ## matches.

summary(suffstats(rMM(10,5,L))) # should be close.




Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MM)
Loading required package: magic
Loading required package: abind
Loading required package: partitions
Loading required package: emulator
Loading required package: mvtnorm
Loading required package: Oarray
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MM/suffstats.Rd_%03d_medium.png", width=480, height=480)
> ### Name: suffstats
> ### Title: Sufficient statistics for the multiplicative multinomial
> ### Aliases: suffstats expected_suffstats print.suffstats summary.suffstats
> ###   print.summary.suffstats
> 
> ### ** Examples
> 
> data(voting)
> suffstats(voting, voting_tally)
$Y
[1] 4

$nobs
[1] 96

$row_sums
Lib Con Lab 
144 138 102 

$cross_prods
    Lib Con Lab
Lib 390 125  61
Con 125 334  93
Lab  61  93 254

> 
> data(wilson)
> wilson <- gunter(non_met)
> suffstats(wilson)
$Y
[1] 5

$nobs
[1] 18

$row_sums
US  S VS 
47 38  5 

$cross_prods
    US   S VS
US 167  61  7
S   61 118 11
VS   7  11  7

> 
> L <- Lindsey(wilson)
> 
> expected_suffstats(L,5)
$row_sums
       US         S        VS 
2.6111111 2.1111111 0.2777778 

$cross_prods
          US         S        VS
US 9.2777778 3.3888889 0.3888889
S  3.3888889 6.5555556 0.6111111
VS 0.3888889 0.6111111 0.3888889

> summary(suffstats(wilson))  ## matches.
$row_sums
       US         S        VS 
2.6111111 2.1111111 0.2777778 

$cross_prods
          US         S        VS
US 9.2777778 3.3888889 0.3888889
S  3.3888889 6.5555556 0.6111111
VS 0.3888889 0.6111111 0.3888889

> 
> summary(suffstats(rMM(10,5,L))) # should be close.
$row_sums
 US   S  VS 
3.8 1.1 0.1 

$cross_prods
     US   S  VS
US 15.8 3.0 0.2
S   3.0 2.3 0.2
VS  0.2 0.2 0.1

> 
> 
> 
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>