BGWM.covar {Branching}R Documentation

Variances and covariances of a multi-type Bienayme - Galton - Watson process

Description

Calculates the covariance matrices of a multi-type Bienayme - Galton - Watson process from its offspring distributions, additionally, it could be obtained the covariance matrices in a specific time n and the covariance matrix of the population in the nth generation, if it is providesd the initial population vector.

Usage

BGWM.covar(dists, type=c("general","multinomial","independents"),
           d, n=1, z0=NULL, maxiter = 1e5)

Arguments

dists

offspring distributions. Its structure depends on the class of the Bienayme - Galton - Watson process (See details and examples).

type

Class or family of the Bienayme - Galton - Watson process (See details and examples).

d

positive integer, number of types.

n

positive integer, nth generation.

z0

nonnegative integer vector of size d; initial population by type.

maxiter

positive integer, size of the simulated sample used to estimate the parameters of univariate distributions that do not have an analytical formula for their exact calculation.

Details

This function calculates the covariance matrices of a multi-type Bienayme - Galton - Watson (BGWM) process from its offspring distributions.

From particular offspring distributions and taking into account a differentiated algorithmic approach, we propose the following classes or types for these processes:

general This option is for BGWM processes without conditions over the offspring distributions, in this case, it is required as input data for each distribution, all d-dimensional vectors with their respective, greater than zero, probability.

multinomial This option is for BGMW processes where each offspring distribution is a multinomial distribution with a random number of trials, in this case, it is required as input data, d univariate distributions related to the random number of trials for each multinomial distribution and a d \times d matrix where each row contains probabilities of the d possible outcomes for each multinomial distribution.

independents This option is for BGMW processes where each offspring distribution is a joint distribution of d combined independent discrete random variables, one for each type of individuals, in this case, it is required as input data d^2 univariate distributions.

The structure need it for each classification is illustrated in the examples.

These are the univariate distributions available:

unif Discrete uniform distribution, parameters min and max. All the non-negative integers between min y max have the same probability.

binom Binomial distribution, parameters n and p.

p(x) = choose(n,x) p^x (1-p)^(n-x)

for x = 0, ..., n.

hyper Hypergeometric distribution, parameters m (the number of white balls in the urn), n (the number of white balls in the urn), k (the number of balls drawn from the urn).

p(x) = choose(m, x) choose(n, k-x) / choose(m+n, k)

for x = 0, ..., k.

geom Geometric distribution, parameter p.

p(x) = p (1-p)^x

for x = 0, 1, 2, ...

nbinom Negative binomial distribution, parameters n and p.

p(x) = Gamma(x+n)/(Gamma(n) x!) p^n (1-p)^x

for x = 0, 1, 2, ...

pois Poisson distribution, parameter lambda.

p(x) = lambda^x exp(-lambda)/x!

for x = 0, 1, 2, ...

norm Normal distribution rounded to integer values and negative values become 0, parameters mu and sigma.

p(x) = \int_{x-0.5}^{x+0.5} 1/(sqrt(2 pi) sigma) e^-((t - mu)^2/(2sigma^2)) dt

for x = 1, 2, ...

p(x) = \int_{-∞}^{0.5} 1/(sqrt(2 pi) sigma) e^-((t - mu)^2/(2sigma^2)) dt

for x = 0

lnorm Lognormal distribution rounded to integer values, parameters logmean = mu y logsd = sigma.

p(x) = \int_{x-0.5}^{x+0.5} 1/(sqrt(2 pi) sigma t) e^-((log t - mu)^2 / (2sigma^2))dt

for x = 1, 2, ...

p(x) = \int_{0}^{0.5} 1/(sqrt(2 pi) sigma t) e^-((log t - mu)^2 / (2sigma^2)) dt

for x = 0

gamma Gamma distribution rounded to integer values, parameters shape = a y scale = s.

p(x)= \int_{x-0.5}^{x+0.5} 1/(s^a Gamma(a)) t^(a-1) e^-(t/s) dt

para x = 1, 2, ...

p(x)= \int_{0}^{0.5} 1/(s^a Gamma(a)) t^(a-1) e^-(t/s) dt

for x = 0

When the offspring distributions used norm, lnorm or gamma, mean and variance related to these univariate distributions is estimated by calculating sample mean and sample variance of maxiter random values generated from the corresponding distribution.

Value

A matrix object with the covariance matrices of the process in the nth generation, combined by rows, or, a matrix object with the covariace matrix of the population in the nth generation, in case of provide the initial population vector (z0).

Author(s)

Camilo Jose Torres-Jimenez cjtorresj@unal.edu.co

References

Torres-Jimenez, C. J. (2010), Relative frequencies and parameter estimation in multi-type Bienaym? - Galton - Watson processes, Master's Thesis, Master of Science in Statistics. Universidad Nacional de Colombia. Bogota, Colombia.

Stefanescu, C. (1998), 'Simulation of a multitype Galton-Watson chain', Simulation Practice and Theory 6(7), 657-663.

Athreya, K. & Ney, P. (1972), Branching Processes, Springer-Verlag.

Harris, T. E. (1963), The Theory of Branching Processes, Courier Dover Publications.

See Also

BGWM.mean, rBGWM, BGWM.mean.estim, BGWM.covar.estim

Examples

## Not run: 
## Variances and covariances of a BGWM process based on a model analyzed
## in Stefanescu (1998) 

# Variables and parameters
d <- 2
n <- 30
N <- c(90, 10)
a <- c(0.2, 0.3)

# with independent distributions
Dists.i <- data.frame( name=rep( "pois", d*d ),
                       param1=rep( a, rep(d,d) ),
                       stringsAsFactors=FALSE )

# covariance matrices of the process
I.matriz.V <- BGWM.covar(Dists.i, "independents", d)

# covariance matrix of the population in the nth generation
# from vector N representing the initial population
I.matrix.V.n_N <- BGWM.covar(Dists.i, "independents", d, n, N)

# with multinomial distributions
dist <- data.frame( name=rep( "pois", d ),
                    param1=a*d,
                    stringsAsFactors=FALSE )
matrix.b <- matrix( rep(0.5, 4), nrow=2 )
Dists.m <- list( dists.eta=dist, matrix.B=matrix.b )

# covariance matrices of the process
M.matrix.V <- BGWM.covar(Dists.m, "multinomial", d)

# covariance matrix of the population in the nth generation
# from vector N representing the initial population
M.matrix.V.n_N <- BGWM.covar(Dists.m, "multinomial", d, n, N)

# with general distributions (approximation)
max <- 30
A <- t(expand.grid(c(0:max),c(0:max)))
aux1 <- factorial(A)
aux1 <- apply(aux1,2,prod)
aux2 <- apply(A,2,sum)
distp <- function(x,y,z){ exp(-d*x)*(x^y)/z }
p <- sapply( a, distp, aux2, aux1 )
prob <- list( dist1=p[,1], dist2=p[,2] )
size <- list( dist1=ncol(A), dist2=ncol(A) )
vect <- list( dist1=t(A), dist2=t(A) )
Dists.g <- list( sizes=size, probs=prob, vects=vect )

# covariance matrices of the process
G.matrix.V <- BGWM.covar(Dists.g, "general", d)

# covariance matrix of the population in the nth generation
# from vector N representing the initial population
G.matrix.V.n_N <- BGWM.covar(Dists.g, "general", d, n, N)

# Comparison of results
I.matrix.V.n_N
I.matrix.V.n_N - M.matrix.V.n_N
M.matrix.V.n_N - G.matrix.V.n_N
G.matrix.V.n_N - I.matrix.V.n_N

## End(Not run)

[Package Branching version 0.9.4 Index]