Random sampling using ovariables as parameters

Share:

Description

Currently there are only GIS functions for producing spatial concentration maps (GIS.Concentration.matrix) and using (closed) spatial population data to calculate exposure (GIS.Exposure).

Usage

1
odirichlet(a, n = 0, ...)

Arguments

a

ovariable containing distribution parameters

n

numeric, number of samples. If 0, openv$N is used instead.

...

arguments passed to oapply

Details

Odirichlet is based on functions ddirichlet and rdirichlet from gtools dirichlet.R (originally contributed by Ian Wilson). The "Dirichlet function" is the multidimensional generalization of the beta distribution: it's the Bayesian canonical distribution for the parameter estimates of a multinomial distribution. Odirichlet samples from the dirichlet distribution given parameter vectors that are processed by oapply.

Value

ovariable

Author(s)

T. Rintala teemu.rintala.a@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
openv$N <- 5

test <- Ovariable(
		output=data.frame(
				a = 1:4, 
				b = rep(letters[1:4], each = 4), 
				c = rep(toupper(letters[1:4]), each = 4^2), 
				Result = 1:(4^3)), 
		marginal=c(rep(TRUE, 3), FALSE))
out <- odirichlet(test, cols = "a")
oapply(out, FUN = sum, cols = "a")

test <- Ovariable(
		output=data.frame(
				a = 1:4, 
				b = rep(letters[1:4], each = 4), 
				Iter = rep(toupper(letters[1:4]), each = 4^2), 
				Result = 1:(4^3)), 
		marginal=c(rep(TRUE, 3),FALSE))
out <- odirichlet(test, cols = "a")
oapply(out, FUN = sum, cols = "a")