Last updated: 2022-11-28

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 4a6005a. 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:  code/poisson_STM/examples.R
    Untracked:  code/poisson_STM/my_vag_pois.R
    Untracked:  code/poisson_STM/splitting_PMF.R
    Untracked:  figure/
    Untracked:  output/poisson_mean_simulation/
    Untracked:  output/poisson_smooth_simulation/

Unstaged changes:
    Modified:   analysis/index.Rmd
    Modified:   analysis/normal_mean_penalty_glm_simplified.Rmd
    Modified:   analysis/overdispersed_splitting.Rmd
    Modified:   analysis/overdispersed_splitting_nb.Rmd
    Modified:   analysis/trendfiltering.ipynb
    Modified:   code/poisson_mean/simulation_summary.R
    Modified:   code/poisson_smooth/simulation_summary_smooth.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/smooth_angles_benchmark_new.Rmd) and HTML (docs/smooth_angles_benchmark_new.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 4a6005a DongyueXie 2022-11-28 wflow_publish("analysis/smooth_angles_benchmark_new.Rmd")

Introduction

In this analysis we look at the results from generating data as

\[y_i\sim Poisson(\exp(b_i+\epsilon_i)),\epsilon_i\sim N(0,\sigma^2).\] The \(\exp(b)\) is smooth and has block structures as follows:

library(tidyverse)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.3.6      ✔ purrr   0.3.5 
✔ tibble  3.1.8      ✔ dplyr   1.0.10
✔ tidyr   1.2.1      ✔ stringr 1.4.1 
✔ readr   2.1.3      ✔ forcats 0.5.2 
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
out = readRDS('output/poisson_smooth_simulation/new_simu/angles30_n_1024_snr_1_count_size_3.rds')
plot(exp(out$sim_data$b),type='l',ylab='')

We set \(n=1024\), repeat 30 times, and count size \(=max(\exp(b))\in \{3,10,100\}\), and \(snr = var(b)/\sigma^2\in \{1,3\}\).

source('code/poisson_smooth/simulation_summary_smooth.R')
all_methods = names(out$output[[1]]$mse_smooth)
include_methods = c('vst_smooth','lik_exp_logx_nug_top','lik_exp_logx_smooth','split_smashpoi_ndwt','split_smashpoi_dwt','smash_two_step_hetero','smash')
rm_methods = all_methods[!(all_methods%in%include_methods)]

count size = 3

snr = 1

out = readRDS('output/poisson_smooth_simulation/new_simu/angles30_n_1024_snr_1_count_size_3.rds')
get_mse_mean(out,rm_method = rm_methods)


|                      |      mean|        sd|
|:---------------------|---------:|---------:|
|smash_two_step_hetero | 0.0309531| 0.0095811|
|smash                 | 0.0396589| 0.0165088|
|vst_smooth            | 0.0414001| 0.0128203|
|split_smashpoi_ndwt   | 0.0494287| 0.0141389|
|split_smashpoi_dwt    | 0.0608428| 0.0159582|
|lik_exp_logx_smooth   | 0.2069340| 0.0390366|
|lik_exp_logx_nug_top  | 0.2553825| 0.0444868|

get_runtime(out,rm_method = rm_methods)

for(method in include_methods){
  plot_all_curves(out,method=method)
}

snr = 3

out = readRDS('output/poisson_smooth_simulation/new_simu/angles30_n_1024_snr_3_count_size_3.rds')
get_mse_mean(out,rm_method = rm_methods)


|                      |      mean|        sd|
|:---------------------|---------:|---------:|
|smash_two_step_hetero | 0.0254256| 0.0087872|
|smash                 | 0.0256060| 0.0097329|
|vst_smooth            | 0.0470157| 0.0137242|
|split_smashpoi_ndwt   | 0.0539747| 0.0150439|
|split_smashpoi_dwt    | 0.0578065| 0.0151372|
|lik_exp_logx_smooth   | 0.2060669| 0.0410352|
|lik_exp_logx_nug_top  | 0.2531711| 0.0462308|

get_runtime(out,rm_method = rm_methods)

for(method in include_methods){
  plot_all_curves(out,method=method)
}

count size = 10

snr = 1

out = readRDS('output/poisson_smooth_simulation/new_simu/angles30_n_1024_snr_1_count_size_10.rds')
get_mse_mean(out,rm_method = rm_methods)


|                      |       mean|        sd|
|:---------------------|----------:|---------:|
|split_smashpoi_ndwt   |  0.3447979| 0.1170142|
|vst_smooth            |  0.4731400| 0.2440202|
|split_smashpoi_dwt    |  0.6606017| 0.1772298|
|smash_two_step_hetero |  0.6646382| 0.2186747|
|lik_exp_logx_smooth   |  0.8251299| 0.2811992|
|lik_exp_logx_nug_top  |  0.9321922| 0.3104204|
|smash                 | 15.7252226| 3.9634624|

get_runtime(out,rm_method = rm_methods)

for(method in include_methods){
  plot_all_curves(out,method=method)
}

snr = 3

out = readRDS('output/poisson_smooth_simulation/new_simu/angles30_n_1024_snr_3_count_size_10.rds')
get_mse_mean(out,rm_method = rm_methods)


|                      |      mean|        sd|
|:---------------------|---------:|---------:|
|vst_smooth            | 0.1870640| 0.0619821|
|split_smashpoi_ndwt   | 0.2055731| 0.0781469|
|smash_two_step_hetero | 0.3795118| 0.1209138|
|split_smashpoi_dwt    | 0.4265718| 0.1059923|
|lik_exp_logx_smooth   | 0.5542755| 0.1571507|
|lik_exp_logx_nug_top  | 0.6127307| 0.1584986|
|smash                 | 2.0894546| 0.6156045|

get_runtime(out,rm_method = rm_methods)

for(method in include_methods){
  plot_all_curves(out,method=method)
}

count size = 100

snr = 1

out = readRDS('output/poisson_smooth_simulation/new_simu/angles30_n_1024_snr_1_count_size_100.rds')
get_mse_mean(out,rm_method = rm_methods)


|                      |        mean|         sd|
|:---------------------|-----------:|----------:|
|lik_exp_logx_nug_top  |    54.57807|   24.18572|
|split_smashpoi_ndwt   |    55.23756|   28.48649|
|lik_exp_logx_smooth   |    64.49398|   29.74338|
|split_smashpoi_dwt    |    90.23235|   28.25920|
|smash_two_step_hetero |    91.35546|   44.90445|
|vst_smooth            |  1282.34929| 2202.58693|
|smash                 | 15333.36040| 6729.09957|

get_runtime(out,rm_method = rm_methods)

for(method in include_methods){
  plot_all_curves(out,method=method)
}

snr = 3

out = readRDS('output/poisson_smooth_simulation/new_simu/angles30_n_1024_snr_3_count_size_100.rds')
get_mse_mean(out,rm_method = rm_methods)


|                      |       mean|         sd|
|:---------------------|----------:|----------:|
|split_smashpoi_ndwt   |   26.24050|   8.890036|
|lik_exp_logx_nug_top  |   31.07092|   9.718367|
|lik_exp_logx_smooth   |   31.58060|  12.005586|
|smash_two_step_hetero |   43.13123|  10.179750|
|vst_smooth            |   45.85319|  30.004548|
|split_smashpoi_dwt    |   46.73828|  11.896783|
|smash                 | 1410.74067| 361.377803|

get_runtime(out,rm_method = rm_methods)

for(method in include_methods){
  plot_all_curves(out,method=method)
}


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] forcats_0.5.2   stringr_1.4.1   dplyr_1.0.10    purrr_0.3.5    
 [5] readr_2.1.3     tidyr_1.2.1     tibble_3.1.8    ggplot2_3.3.6  
 [9] tidyverse_1.3.2 workflowr_1.7.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9          lubridate_1.9.0     getPass_0.2-2      
 [4] ps_1.7.1            assertthat_0.2.1    rprojroot_2.0.3    
 [7] digest_0.6.29       utf8_1.2.2          plyr_1.8.7         
[10] R6_2.5.1            cellranger_1.1.0    backports_1.4.1    
[13] reprex_2.0.2        evaluate_0.17       highr_0.9          
[16] httr_1.4.4          pillar_1.8.1        rlang_1.0.6        
[19] readxl_1.4.1        googlesheets4_1.0.1 rstudioapi_0.14    
[22] whisker_0.4         callr_3.7.2         jquerylib_0.1.4    
[25] rmarkdown_2.17      labeling_0.4.2      googledrive_2.0.0  
[28] munsell_0.5.0       broom_1.0.1         compiler_4.2.1     
[31] httpuv_1.6.6        modelr_0.1.9        xfun_0.33          
[34] pkgconfig_2.0.3     htmltools_0.5.3     tidyselect_1.2.0   
[37] fansi_1.0.3         crayon_1.5.2        withr_2.5.0        
[40] tzdb_0.3.0          dbplyr_2.2.1        later_1.3.0        
[43] grid_4.2.1          jsonlite_1.8.2      gtable_0.3.1       
[46] lifecycle_1.0.3     DBI_1.1.3           git2r_0.30.1       
[49] magrittr_2.0.3      scales_1.2.1        cli_3.4.1          
[52] stringi_1.7.8       cachem_1.0.6        farver_2.1.1       
[55] reshape2_1.4.4      fs_1.5.2            promises_1.2.0.1   
[58] xml2_1.3.3          bslib_0.4.0         ellipsis_0.3.2     
[61] generics_0.1.3      vctrs_0.4.2         tools_4.2.1        
[64] glue_1.6.2          hms_1.1.2           processx_3.7.0     
[67] fastmap_1.1.0       yaml_2.3.5          timechange_0.1.1   
[70] colorspace_2.0-3    gargle_1.2.1        rvest_1.0.3        
[73] knitr_1.40          haven_2.5.1         sass_0.4.2