l_dens2D | R Documentation |
This layer adds a 2D density estimate heat-map to a plot.
For 1D effect plots, it adds either the conditional density of the partial
residuals, p(r|x)
, or the joint density p(r, x)
. For 2D
effect plots it adds either p(x1|x2)
or p(x1, x2)
, where
x1
and x2
are the relevant covariates.
l_dens2D(type, n = c(50, 50), bw = NULL, tol = 1e-06, trans = sqrt, ...)
l_dens(type, n = c(50, 50), bw = NULL, tol = 1e-06, trans = sqrt, ...)
type |
for 1D effect plots, if set to "cond" then the conditional residual
density |
n |
vector of two positive integers, indicating the number of grid points at which the density is evaluated on the x and y axes. |
bw |
vector with two positive entries, indicating the bandwidth to be used
by the kernel density estimator of |
tol |
small positive numerical tolerance. The estimated density at a certain
location is set to |
trans |
the density on x-y is transformed using this function before being plotted. |
... |
graphical arguments to be passed to |
The density function is estimated using the fast binned kernel density estimation
methods provided by the KernSmooth
package, hence this function should be
able to handle relatively large datasets (~ 10^6 observations).
An object of class gamLayer
.
See plot.mgcv.smooth.1D, plot.mgcv.smooth.2D and check1D for examples.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.