Description Usage Arguments Details Examples
Plots a kernel density for a mvnd
object.
1 | kernel_density(object, n = 10000, ...)
|
object |
a |
n |
sampling depth used for kernel density estimation. |
... |
additional arguments passed to the plot function. |
Draws random samples from a multivariate normal distribution of
mvnd
object and plots the kernel density of those.
Requires the mvrnorm from the MASS package for random sampling. If present,
the package LSD is used for kernel density coloring. ... argments are
passed to generic plot or heatscatter
functions if LSD
package is installed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | x <- rnorm(100)
b <- 1.3
w0 <- 0.2 ; w1 <- 3
y <- rnorm(100, mean = w0 + w1 * x, sd = sqrt(1/b))
model <- blm(y ~ x, prior = NULL, beta = b,
data = data.frame(x=x, y=y))
## Not run:
par(mfrow=c(1,2))
kernel_density(model$prior, xlim=c(-4,4), ylim=c(-4,4), main='prior')
kernel_density(model$posterior, xlim=c(-4,4), ylim=c(-4,4), main='posterior')
par(mfrow=c(1,1))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.