simCylinderSystem {unfoldr}R Documentation

Simulation of cylinder system

Description

Simulation of Poisson cylinder system

Usage

simCylinderSystem(theta, lam, size = "const", shape = "const",
  orientation = "rbetaiso", type = c("sphero", "elong"), rjoint = NULL,
  box = list(c(0, 1)), mu = c(0, 1, 0), perfect = TRUE, pl = 0,
  label = "N")

Arguments

theta

simulation parameters

lam

mean number of spheroids per unit volume

size

size="const" (default) or name of random generating function a for specific size distribution

shape

either shape="const" as a constant portion of the axis length or shape="rbeta" as beta distributed shape factor. For a radius distribution use your own joint distribution, see details.

orientation

name of random generating function for orientation distribution

rjoint

name of joint random generating function

box

simulation box

mu

main orientation axis, mu=c(0,1,0) (default)

perfect

logical: perfect=TRUE (default) simulate perfect

pl

optional: print level

label

optional: set a label to all generated spheroids

Details

The function simulates a Poisson (sphero)cylinder system according to the supplied simulation parameter theta in a predefined simulation box. The argument size is of type string and denotes the major-axis length random generating function name.

For the directional orientation of the cylinder axis one has the choice of a uniform (runifdir), isotropic random planar (rbetaiso, see reference) or von Mises-Fisher (rvMisesFisher) distribution. The simulation box is a list containing of vector arguments which correspond to the lower and upper points in each direction. If the argument box has only one element, i.e. list(c(0,1), the same extent is used for the other dimensions. If rjoint="rmulti" names a joint random generating function then argument size is ignored (see example file "sim.R"). For the purpose of exact simulation setting size equal to rbinorm declares a bivariate normal size-shape distribution which leads to a lognormally distributed half height (length) h/2 of the cylinder. The main orientation axis of the cylinder is called u where its length equals h without the end caps and a scaled radius r. The total length then equals h+2r. If [X,Y] follow a bivariate normal distribution with correlation parameter ρ then h=2.0*exp(x) defines the sample cylinder axis length together with the scaled radius r=0.5*h*s and shape parameter set to s=1/(1+exp(-y)). The parameter ρ defines the degree of correlation between the cylinder axis length and cylinder radius which must be provided as part of the list of simulation parameters theta. The method of exact simulation is tailored to the above described model. For a general approach please see the given reference below. Other (univariate) cylinder axis lengths types include the beta, gamma, lognormal and uniform distribution where the shape factor to get the radius either follows a beta distribution or is set to a constant. Despite the case of constant size simulations all other simulations are done as perfect simulations. The current implementation does not include routines for unfolding the joint 3d size-shape-orientation distribution of cylinders so far. However, this feature this might be provided in a later version.

The argument pl denotes the print level of output information during simulation. Currently, only pl=0 for no output and pl>100 for some additional info is implemented.

Value

list of cylinders

References

Examples

## Not run: 

lam <- 10
box <- list("xrange"=c(0,3),"yrange"=c(0,3),"zrange"=c(0,9))

# cylinders of constant length
theta <- list("size"=list(0.25),
			  "shape"=list(0.5),
			  "orientation"=list("kappa"=1))

S <- simCylinderSystem(theta,lam,size="const", shape="const",
						orientation="rbetaiso",box=box,pl=101)
				
# cylinders of constant length with
# beta distributed radius	
theta <- list("size"=list(0.35),
              "shape"=list("a"=1,"b"=5),
			  "orientation"=list("kappa"=1.5))				
				
S <- simCylinderSystem(theta,lam,size="const", shape="rbeta",
				orientation="rbetaiso",box=box,pl=101)
				
# bivariate length-shape distribution
# possibly correlated 
param <- list("mx"=-1.0,"my"=-2.5, "sdx"=0.15,"sdy"=0.2,"rho"=0.0,"kappa"=1.0)
theta <- list("size"=list("mx"=param$mx,"sdx"=param$sdx,
						  "my"=param$my,"sdy"=param$sdy,
						  "rho"=param$rho),
			  "orientation"=list("kappa"=param$kappa),
			  "shape"=list())
		
S <- simCylinderSystem(theta,lam,size="rbinorm",orientation="rbetaiso",box=box,pl=101)	

## show cylinder system
#cols <- c("#0000FF","#00FF00","#FF0000","#FF00FF","#FFFF00","#00FFFF")
#cylinders3d(S, box, col=cols)
 

## End(Not run)

[Package unfoldr version 0.6.3 Index]