Description Usage Arguments Value Author(s) See Also Examples
View source: R/approximations.R
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
1 |
mix |
An object of class |
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. |
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.
Jiaxun Chen, Sakis Micheas, Yuchen Wang
normmix,
rnormmix,
plotmix_2d,
plot_density,
to_int_surf
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.