rm(list=ls()) ### To clear namespace library(knitr) # opts_chunk$set(fig.width=12, fig.height=8, fig.path='Figs/', # echo=TRUE, warning=FALSE, message=FALSE) opts_chunk$set(fig.width= 7, fig.height= 5, echo=TRUE, warning=FALSE, message=FALSE)
Recall that kernel deconvolution density estimators (KDDE).
library(kerdec) error <- rlaplace(150) ks.test(error, plaplace) ks.test(error, rlaplace(200)) ## ------------------------------------------------------------------- library(kerdec) library(dplyr) library(purrr) library(tidyr) library(ggplot2) ## alp <- 5; bet <- 7 n <- 250 m <- 200 X <- rgamma(n, alp, bet) eps <- rlaplace(m, sd = sd(X)) Y <- X + rlaplace(n, sd = sd(X)) qplot(X, geom = "density") data_frame(original = X, contaminated = Y) %>% gather(sample, value) %>% ggplot(aes(value)) + geom_density(aes(color = sample)) kerdec_dens(Y, error_dist = "laplace", error_scale_par = sd(X))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.