Last data update: 2014.03.03

R: Random samples from the multiplicative multinomial
rMMR Documentation

Random samples from the multiplicative multinomial

Description

Density, and random samples drawn from, the multiplicative multinomial

Usage

rMM(n, Y, paras, burnin = 4*Y, every = 4*Y, start = NULL)
dMM(Y, paras)

Arguments

n

Number of observations to make

Y

Sum of each observation (for example, 100 for the pollen dataset, 4 for voting)

paras

Parameters of the MM distribution; an object of class paras

every

Each row is recorded every every steps through the Markov chain. Thus every=10 means every tenth row is written to the returned matrix during MH process (and the other nine values are discarded)

burnin

Number of initial observations to ignore

start

Observation to start simulation, with default NULL corresponding to using a random start vector

Details

Function rMM() uses standard Metropolis-Hastings simulation.

Function dMM() is documented here for convenience; see help(MM) for related functionality.

Value

Returns a matrix with n rows and length(paras) columns. Each row is an observation.

Author(s)

Robin K. S. Hankin

See Also

MM

Examples

data(voting)
rMM(10,4,Lindsey(voting,voting_tally))

p <- paras(3)
theta(p) <- 2
dMM(1:3,p)

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/rMM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: rMM
> ### Title: Random samples from the multiplicative multinomial
> ### Aliases: rMM dMM
> 
> ### ** Examples
> 
> data(voting)
> rMM(10,4,Lindsey(voting,voting_tally))
      Lib Con Lab
 [1,]   2   2   0
 [2,]   0   2   2
 [3,]   0   4   0
 [4,]   1   2   1
 [5,]   3   0   1
 [6,]   1   3   0
 [7,]   1   3   0
 [8,]   0   3   1
 [9,]   3   1   0
[10,]   2   2   0
> 
> p <- paras(3)
> theta(p) <- 2
> dMM(1:3,p)
[1] 0.1018133
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>