Last updated: 2022-11-21
Checks: 7 0
Knit directory: gsmash/
This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20220606)
was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 7dafd94. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: data/poisson_mean_simulation/
Untracked files:
Untracked: figure/
Untracked: output/poisson_mean_simulation/
Untracked: output/poisson_smooth_simulation/
Unstaged changes:
Modified: analysis/normal_mean_penalty_glm_simplified.Rmd
Modified: code/poisson_mean/simulation_summary.R
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown
(analysis/overdispersed_splitting.Rmd
) and HTML
(docs/overdispersed_splitting.html
) files. If you’ve
configured a remote Git repository (see ?wflow_git_remote
),
click on the hyperlinks in the table below to view the files as they
were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 7dafd94 | DongyueXie | 2022-11-21 | wflow_publish("analysis/overdispersed_splitting.Rmd") |
We simulate data from the following model,
yi∼Poisson(exp(μi)),μi|bi∼N(bi,σ2),bi∼π0δ0+π1 N(0,2). And Run splitting method with fixed and known σ2.
library(vebpm)
set.seed(12345)
n = 3000
prior_mean = 0
b = c(rep(prior_mean,n*0.8) , rnorm(n*0.2,prior_mean,sqrt(2)))
sigma2 = 0.1
mu = rnorm(n,b,sigma2)
y = rpois(n,exp(mu))
fix σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = FALSE,mu_pm_init = log(y+1))
fit$elbo
[1] -7765.855
plot(b,col='grey80')
lines(fit$posterior$mean_b)
estimate σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = T,mu_pm_init = log(y+1))
Warning in pois_mean_split2(y, sigma2 = sigma2, est_sigma2 = T, mu_pm_init =
log(y + : An iteration decreases ELBO. This is likely due to numerical issues.
fit$elbo
[1] -7764.585
plot(b,col='grey80')
lines(fit$posterior$mean_b)
n = 3000
prior_mean = 0
b = c(rep(prior_mean,n*0.8) , rnorm(n*0.2,prior_mean,sqrt(2)))
sigma2 = 0.1
mu = rnorm(n,b,sigma2)
y = rpois(n,exp(mu))
fix σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = FALSE,mu_pm_init = log(y+1))
fit$elbo
[1] -7584.489
plot(b,col='grey80')
lines(fit$posterior$mean_b)
estimate σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = T,mu_pm_init = log(y+1))
Warning in pois_mean_split2(y, sigma2 = sigma2, est_sigma2 = T, mu_pm_init =
log(y + : An iteration decreases ELBO. This is likely due to numerical issues.
fit$elbo
[1] -7572.811
plot(b,col='grey80')
lines(fit$posterior$mean_b)
n = 3000
prior_mean = 0
b = c(rep(prior_mean,n*0.8) , rnorm(n*0.2,prior_mean,sqrt(2)))
sigma2 = 0.1
mu = rnorm(n,b,sigma2)
y = rpois(n,exp(mu))
fix σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = FALSE,mu_pm_init = log(y+1))
fit$elbo
[1] -7566.159
plot(b,col='grey80')
lines(fit$posterior$mean_b)
estimate σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = T,mu_pm_init = log(y+1))
Warning in pois_mean_split2(y, sigma2 = sigma2, est_sigma2 = T, mu_pm_init =
log(y + : An iteration decreases ELBO. This is likely due to numerical issues.
fit$elbo
[1] -7568.7
plot(b,col='grey80')
lines(fit$posterior$mean_b)
set.seed(12345)
n = 3000
prior_mean = 0
b = c(rep(prior_mean,n*0.8) , rnorm(n*0.2,prior_mean,sqrt(2)))
sigma2 = 0.5
mu = rnorm(n,b,sigma2)
y = rpois(n,exp(mu))
fix σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = FALSE,mu_pm_init = log(y+1))
Warning in pois_mean_split2(y, sigma2 = sigma2, est_sigma2 = FALSE, mu_pm_init =
log(y + : An iteration decreases ELBO. This is likely due to numerical issues.
fit$elbo
[1] -7975.276
plot(b,col='grey80')
lines(fit$posterior$mean_b)
estimate σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = T,mu_pm_init = log(y+1))
Warning in pois_mean_split2(y, sigma2 = sigma2, est_sigma2 = T, mu_pm_init =
log(y + : An iteration decreases ELBO. This is likely due to numerical issues.
fit$elbo
[1] -7917.981
plot(b,col='grey80')
lines(fit$posterior$mean_b)
n = 3000
prior_mean = 0
b = c(rep(prior_mean,n*0.8) , rnorm(n*0.2,prior_mean,sqrt(2)))
sigma2 = 0.5
mu = rnorm(n,b,sigma2)
y = rpois(n,exp(mu))
fix σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = FALSE,mu_pm_init = log(y+1))
Warning in pois_mean_split2(y, sigma2 = sigma2, est_sigma2 = FALSE, mu_pm_init =
log(y + : An iteration decreases ELBO. This is likely due to numerical issues.
fit$elbo
[1] -7872.092
plot(b,col='grey80')
lines(fit$posterior$mean_b)
estimate σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = T,mu_pm_init = log(y+1))
Warning in pois_mean_split2(y, sigma2 = sigma2, est_sigma2 = T, mu_pm_init =
log(y + : An iteration decreases ELBO. This is likely due to numerical issues.
fit$elbo
[1] -7836.155
plot(b,col='grey80')
lines(fit$posterior$mean_b)
n = 3000
prior_mean = 0
b = c(rep(prior_mean,n*0.8) , rnorm(n*0.2,prior_mean,sqrt(2)))
sigma2 = 0.5
mu = rnorm(n,b,sigma2)
y = rpois(n,exp(mu))
fix σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = FALSE,mu_pm_init = log(y+1))
Warning in pois_mean_split2(y, sigma2 = sigma2, est_sigma2 = FALSE, mu_pm_init =
log(y + : An iteration decreases ELBO. This is likely due to numerical issues.
fit$elbo
[1] -7806.89
plot(b,col='grey80')
lines(fit$posterior$mean_b)
estimate σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = T,mu_pm_init = log(y+1))
Warning in pois_mean_split2(y, sigma2 = sigma2, est_sigma2 = T, mu_pm_init =
log(y + : An iteration decreases ELBO. This is likely due to numerical issues.
fit$elbo
[1] -7786.328
plot(b,col='grey80')
lines(fit$posterior$mean_b)
set.seed(12345)
n = 3000
prior_mean = 5
b = c(rep(prior_mean,n*0.8) , rnorm(n*0.2,prior_mean,sqrt(2)))
sigma2 = 0.5
mu = rnorm(n,b,sigma2)
y = rpois(n,exp(mu))
fix σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = FALSE,mu_pm_init = log(y+1))
fit$elbo
[1] -21419.77
plot(b,col='grey80')
lines(fit$posterior$mean_b)
estimate σ2
fit = pois_mean_split2(y,sigma2=sigma2,est_sigma2 = T,mu_pm_init = log(y+1))
fit$elbo
[1] -21317.76
plot(b,col='grey80')
lines(fit$posterior$mean_b)
sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.5 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] vebpm_0.2.6 workflowr_1.7.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.9 horseshoe_0.2.0 invgamma_1.1 lattice_0.20-45
[5] nleqslv_3.3.3 getPass_0.2-2 ps_1.7.1 assertthat_0.2.1
[9] rprojroot_2.0.3 digest_0.6.29 utf8_1.2.2 truncnorm_1.0-8
[13] R6_2.5.1 rootSolve_1.8.2.3 evaluate_0.17 highr_0.9
[17] httr_1.4.4 ggplot2_3.3.6 pillar_1.8.1 rlang_1.0.6
[21] rstudioapi_0.14 ebnm_1.0-9 irlba_2.3.5.1 nloptr_2.0.3
[25] whisker_0.4 callr_3.7.2 jquerylib_0.1.4 Matrix_1.5-1
[29] rmarkdown_2.17 splines_4.2.1 stringr_1.4.1 munsell_0.5.0
[33] mixsqp_0.3-43 compiler_4.2.1 httpuv_1.6.6 xfun_0.33
[37] pkgconfig_2.0.3 SQUAREM_2021.1 htmltools_0.5.3 tidyselect_1.2.0
[41] tibble_3.1.8 matrixStats_0.62.0 fansi_1.0.3 dplyr_1.0.10
[45] later_1.3.0 grid_4.2.1 jsonlite_1.8.2 gtable_0.3.1
[49] lifecycle_1.0.3 DBI_1.1.3 git2r_0.30.1 magrittr_2.0.3
[53] scales_1.2.1 ebpm_0.0.1.3 cli_3.4.1 stringi_1.7.8
[57] cachem_1.0.6 fs_1.5.2 promises_1.2.0.1 bslib_0.4.0
[61] generics_0.1.3 vctrs_0.4.2 trust_0.1-8 tools_4.2.1
[65] glue_1.6.2 parallel_4.2.1 processx_3.7.0 fastmap_1.1.0
[69] yaml_2.3.5 colorspace_2.0-3 ashr_2.2-54 deconvolveR_1.2-1
[73] knitr_1.40 sass_0.4.2