Description Usage Arguments Details Value Author(s) Examples

Generates a pixel image of a bivariate normal mixture density observed on a bounded window using a specified number of contributing densities with randomly selected means and variance-covariance matrices.

1 |

`N` |
The number of Gaussian components to generate for the mixture. |

`window` |
An object of class |

`v` |
The degrees of freedom for the inverse-Wishart distribution of the variance-covariance matrices (must be at least 4). The default value of 4 ensures the generated covariance matrices are centered on |

`S` |
A symmetric, positive-definite |

`extras` |
A logical value indicating whether, in addition to returning the pixel |

`...` |
Additional arguments to be passed to |

This function creates and returns a bivariate Gaussian mixture density on a bounded `window`

based on `N`

randomly generated mean locations and corresponding randomly generated variance-covariance matrices. First, the `N`

mean locations are generated based on a uniform distribution over the spatial `window`

. Each location is then associated with a covariance matrix generated from an inverse-Wishart distribution with `v`

degrees of freedom and scale matrix `S`

.

Once the above steps are completed, the function calls `sgmix`

with the chosen mean and covariance matrices, thereby creating the Gaussian mixture. Resolution and other aspects of this call can be controlled by using `...`

, passing the contents internally to `sgmix`

. By default, all generated Gaussian components have equal weight in contributing to the final mixture density. The user can alter this by passing `p0`

and `p`

to the `...`

, though should take care that the length of `p`

is `N`

, and that `p0`

and `p`

sum to 1, as outlined in the documentation for `sgmix`

.

If `extras = FALSE`

(default), then a pixel `im`

age of the final mixture density. If `extras = TRUE`

, a list is returned with members `f`

(the pixel `im`

age of the final mixture density); `mn`

(a *2 \times* `N`

matrix with each column giving the mean location of each of the `N`

Gaussian bumps); and `vcv`

(a *2 \times 2 \times* `N`

array with layers giving the covariance matrices associated with the means in the columns of `mn`

).

A.K. Redmond and T.M. Davies

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
set.seed(321)
dens1 <- rgmix(7,window=toywin)
plot(dens1)
set.seed(456)
dens2 <- rgmix(7,window=toywin)
plot(dens2)
# Explicitly return details of generated means and covariances
set.seed(321)
dens1.detailed <- rgmix(7,window=toywin,extras=TRUE)
dens1.detailed$f
dens1.detailed$mn
dens1.detailed$vcv
# Set underlying uniform proportion and compare with dens2 from above
set.seed(456)
dens2.wunif <- rgmix(7,window=toywin,p0=0.3)
par(mfrow=c(1,2))
plot(rpoint(500,dens2))
plot(rpoint(500,dens2.wunif))
# Explicitly setting scale matrix for inverse-wishart generation of covariances
dens3 <- rgmix(3,window=toywin,S=matrix(c(0.025,-0.004,-0.004,0.02),2))
plot(dens3)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.