kernel_density: Density Plot of Multivariate Normal Distribution

Description Usage Arguments Details Examples

Description

Plots a kernel density for a mvnd object.

Usage

1
kernel_density(object, n = 10000, ...)

Arguments

object

a mvnd object

n

sampling depth used for kernel density estimation.

...

additional arguments passed to the plot function.

Details

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.

Examples

 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) 
               

manschmi/blmr documentation built on May 21, 2019, 11:25 a.m.