Last data update: 2014.03.03

R: Manipulate a paras object
parasR Documentation

Manipulate a paras object

Description

Various utilities to manipulate paras objects. Functions pnames() and pnames<-() operate on MB objects as expected.

Usage

paras(x, p, theta, pnames = character(0))
p(x) <- value
theta(x) <- value
p(x)
theta(x)
pnames(x)
pnames(x) <- value
getVals(x)
## S4 method for signature 'paras'
length(x)

Arguments

x

Object of class paras

p

In function paras(), a vector of the first k-1 elements of the probabilities

theta

In function paras(), a k by k matrix with diagonal composed of ones

pnames

In function paras(), a character vector of names for the entries

value

Replacement value

Details

A paras object contains the parameters needed to specify a multiplicative multinomial distribution.

Suppose p is an object of class paras object. Then p is a list of two elements. The first element, p, is a vector of length length(p) and the second is an upper-diagonal matrix square matrix of size length(p). The vignette gives further details.

The functions documented here allow the user to inspect and change paras objects.

Author(s)

Robin K. S. Hankin

See Also

MM, MB

Examples

jj <- paras(5)
pnames(jj) <- letters[1:5]
p(jj) <- c(0.1, 0.1, 0.3, 0.1)
theta(jj) <- matrix(1:25,5,5)
pnames(jj) <- letters[1:5]
jj

# OK, we've defined jj, now use it with some other functions:
dMM(rep(1,5),jj)
MM_single(1:5,jj)
rMM(2,9,jj)

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/paras.Rd_%03d_medium.png", width=480, height=480)
> ### Name: paras
> ### Title: Manipulate a paras object
> ### Aliases: paras paras-class p p,paras-method p<- p<-,paras-method theta
> ###   theta<- theta,paras-method theta<-,paras-method pnames
> ###   pnames,paras-method pnames,MB-method pnames<- pnames<-,paras-method
> ###   pnames<-,MB-method getVals getVals,paras-method length,paras-method
> 
> ### ** Examples
> 
> jj <- paras(5)
> pnames(jj) <- letters[1:5]
> p(jj) <- c(0.1, 0.1, 0.3, 0.1)
> theta(jj) <- matrix(1:25,5,5)
> pnames(jj) <- letters[1:5]
> jj
$p
  a   b   c   d   e 
0.1 0.1 0.3 0.1 0.4 

$theta
   a  b  c  d  e
a NA  6 11 16 21
b NA NA 12 17 22
c NA NA NA 18 23
d NA NA NA NA 24
e NA NA NA NA NA

> 
> # OK, we've defined jj, now use it with some other functions:
> dMM(rep(1,5),jj)
[1] 0.2047225
> MM_single(1:5,jj)
[1] 9.203747e+105
> rMM(2,9,jj)
     a b c d e
[1,] 1 2 1 3 2
[2,] 0 1 2 3 3
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>