dnormmix: Calculate the density or intensity of a normal mixture over a...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/approximations.R

Description

When a normmix object is given, this function calculates the mixture density over a fine grid for the given window. When an intensity_surface object is given, the function multiplies the density with the intensity surface parameter lambda, and returns the Poisson mixture intensity function over the grid. Used for plotting.

For examples see

http://faculty.missouri.edu/~micheasa/sppmix/sppmix_all_examples.html#dnormmix

Usage

1
dnormmix(mix, xlim = c(0, 1), ylim = c(0, 1), L = 128, truncate = TRUE)

Arguments

mix

An object of class normmix or intensity_surface

xlim, ylim

Vectors defining the x-y integration limits. A mixture component mass is estimated within this window.

L

Length of the side of the square grid. The density or intensity is calculated on an L * L grid. The larger this value is, the slower the calculation, but the better the approximation.

truncate

Requests to truncate the components of the mixture intensity to have all their mass within the given x-y limits.

Value

An object of class im. This is a pixel image on a grid with values corresponding to the density (or intensity surface) at that location.

Author(s)

Jiaxun Chen, Sakis Micheas, Yuchen Wang

See Also

normmix, rnormmix, plotmix_2d, plot_density, to_int_surf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
truemix <- rnormmix(m = 3, sig0 = .1, df = 5,xlim= c(0, 5),
 ylim = c(0, 5))
normdens=dnormmix(truemix,xlim= c(0, 5), ylim = c(0, 5))
#2d plots
plot_density(as.data.frame(normdens))+ ggplot2::ggtitle(
 "2d mixture density plot\nWindow=[0,5]x[0,5]")
plot_density(as.data.frame(normdens),TRUE)+ ggplot2::ggtitle(
 "2d mixture contour plot\nWindow=[0,5]x[0,5]")
#3d plot
plotmix_3d(normdens)
#Now build an intensity surface based on the normal mixture
intsurf=to_int_surf(truemix,lambda = 100, win =
 spatstat::owin( c(0, 5),c(0, 5)))
intsurfdens=dnormmix(intsurf,xlim= c(0, 5), ylim = c(0, 5))
plot_density(as.data.frame(intsurfdens))+ ggplot2::ggtitle(
 "2d mixture intensity plot\nWindow=[0,5]x[0,5]")
plot_density(as.data.frame(intsurfdens),TRUE)+ ggplot2::ggtitle(
 "2d mixture intensity contour plot\nWindow=[0,5]x[0,5]")
plotmix_3d(normdens)#3d plot
#For an intensity surface object we use these functions instead
plotmix_2d(intsurf)
plot(intsurf)

sppmix documentation built on Jan. 13, 2021, 10:04 p.m.