stgmix {spagmix} | R Documentation |
Trivariate Gaussian mixture density generation
Description
Generates a pixel image array of a specified trivariate normal mixture density observed on a bounded window in space and time.
Usage
stgmix(mean, vcv, window, tlim, p0 = 0, p = NULL, sres = 128, tres = sres, int = 1)
Arguments
mean |
A |
vcv |
A |
window |
An object of class |
tlim |
A vector of length 2 giving the boundaries of the time interval on which the mixture density is defined. |
p0 |
The proportion of uniform density that contributes to the final mixture (default is 0). |
p |
A numeric vector of the |
sres |
The spatial resolution (number of pixels) along each side of the spatial grid (default is 128). |
tres |
The temporal resolution (default is to equate with |
int |
A positive numeric value for post-hoc rescaling of the density (useful if the user wishes to return a spatiotemporal intensity function). Defaults to 1 for no change in scaling. |
Details
This function creates a 3D array of a density function made up of a mixture of N
trivariate normals with the interpretation of a continuous probability density function in space-time. As such, each component is restricted to conserve mass over a 3D region specified by a fixed polygonal window
in space, stretched over defined temporal limits (tlim
). A warning will appear if less than 1% of the integral of each Gaussian bump is inside this observational spatiotemporal polyhedron.
Value
An object of class stim
giving the trivariate density. This is a list with six components:
a |
The |
v |
A pixel |
xcol |
Grid coordinates in the spatial x-axis (corresponds to each spatial |
yrow |
Grid coordinates in the spatial y-axis (corresponds to each spatial |
tlay |
Grid coordinates in the temporal axis (corresponds to the order of the spatial |
W |
A copy of |
Author(s)
A.K. Redmond and T.M. Davies
Examples
require("abind")
m1 <- c(0.3,0.3,2)
m2 <- c(0.5,0.8,8)
m3 <- c(0.7,0.6,7)
v1 <- diag(c(0.01^2,0.01^2,1))
v2 <- diag(c(0.005,0.005,0.5))
v3 <- diag(c(0.005,0.005,0.5))
stg1 <- stgmix(mean=cbind(m1,m2,m3),
vcv=abind(v1,v2,v3,along=3),
window=toywin,tlim=c(1,10),
p0=0.1,tres=64)
plot(stg1,log=TRUE)
mn <- matrix(c(0,0,0,-2,1,4,1,-2,8),nrow=3)
vr <- array(c(1,0,0,0,1,0,0,0,1,1,0,0.5,0,1,0,0.5,0,3,1,0,0,0,2,0,0,0,1),
dim=c(3,3,3))
stg2 <- stgmix(mean=mn,vcv=vr,window=shp1,
tlim=c(0,10),tres=50)
plot(stg2,fix.range=TRUE,sleep=0.1)