Last updated: 2018-05-21
workflowr checks: (Click a bullet for more information) ✔ R Markdown file: up-to-date
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.
✔ Environment: empty
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.
✔ Seed:
set.seed(20180501)
The command set.seed(20180501)
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.
✔ Session information: recorded
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
✔ Repository version: 32bf30d
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: log/
Untracked files:
Untracked: analysis/binom.Rmd
Untracked: analysis/overdis.Rmd
Untracked: analysis/smashtutorial.Rmd
Untracked: data/treas_bill.csv
Untracked: docs/figure/smashtutorial.Rmd/
Unstaged changes:
Modified: analysis/ashpmean.Rmd
Modified: analysis/nugget.Rmd
Modified: analysis/poiunknown.Rmd
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.
We have shown that smashgen-Poisson outperforms smash when smoothing Poisson data with nugget effect. One natural question is: is this true for Poisson data(no nugget effect)?
One limitation of smash.pois
is that it can only use an analogue of the Haar wavelet transform to the Poisson data. So it may lose power when dealing with wavelet whose signal is better captured by more complex basis functions.
In this analysis, we try to address the above two questions.
We have seen in the previous analysis that Symmlet 8 gives better decomposition for smoother functions, while for functions with spike or sharp changes, the two basis have similar results.
simu_study_basis=function(mu,nsimu=100,seed=1234,niter=1,robust=F){
n=length(mu)
set.seed(seed)
smash.err=c()
gen.haar.err=c()
gen.sym.err=c()
for(iter in 1:nsimu){
y=rpois(n,mu)
smash.out=smash.poiss(y)
gen.haar.out=smash_gen(y,niter = niter,robust=robust)
gen.sym.out=smash_gen(y,wave_family = 'DaubLeAsymm',filter.number = 8,niter=niter,robust=robust)
smash.err[iter]=mse(smash.out,mu)
gen.haar.err[iter]=mse(gen.haar.out,mu)
gen.sym.err[iter]=mse(gen.sym.out,mu)
}
return(list(est=data.frame(smash=smash.out,smashgen.haar=gen.haar.out,smashgen.sym=gen.sym.out),err=data.frame(smash=smash.err,smashgen.haar=gen.haar.err,smashgen.sym=gen.sym.err)))
}
range of \(\mu\) roughly \((0.3,7)\).
library(smashrgen)
mu=DJ.EX(256,signal = 2)$heavi
mu=mu-min(mu)+0.3
plot(mu,type='l')
Version | Author | Date |
---|---|---|
af7fd47 | Dongyue | 2018-05-20 |
result=simu_study_basis(mu)
boxplot(result$err)
Version | Author | Date |
---|---|---|
af7fd47 | Dongyue | 2018-05-20 |
range of \(\mu\) roughly \((0.1,67)\).
mu=DJ.EX(256,signal = 20)$heavi
mu=mu-min(mu)+0.1
#plot(mu,type='l')
result=simu_study_basis(mu)
boxplot(result$err)
Version | Author | Date |
---|---|---|
af7fd47 | Dongyue | 2018-05-20 |
range of \(\mu\) roughly \((0.1,7)\).
mu=DJ.EX(256,signal = 2)$doppler
mu=mu-min(mu)+0.1
plot(mu,type='l')
Version | Author | Date |
---|---|---|
af7fd47 | Dongyue | 2018-05-20 |
result=simu_study_basis(mu)
boxplot(result$err)
Version | Author | Date |
---|---|---|
af7fd47 | Dongyue | 2018-05-20 |
range of \(\mu\) roughly \((0.1,70)\).
mu=DJ.EX(256,signal = 20)$doppler
mu=mu-min(mu)+0.1
#plot(mu,type='l')
result=simu_study_basis(mu)
boxplot(result$err)
Version | Author | Date |
---|---|---|
af7fd47 | Dongyue | 2018-05-20 |
range of \(\mu\) roughly \((0.1,6)\).
r=function(x,c){return((x-c)^2*(x>c)*(x<=1))}
f=function(x){return(0.8 − 30*r(x,0.1) + 60*r(x, 0.2) − 30*r(x, 0.3) +
500*r(x, 0.35) − 1000*r(x, 0.37) + 1000*r(x, 0.41) − 500*r(x, 0.43) +
7.5*r(x, 0.5) − 15*r(x, 0.7) + 7.5*r(x, 0.9))}
mu=f(1:256/256)
mu=mu*10-1.9
plot(mu,type = 'l')
Version | Author | Date |
---|---|---|
af7fd47 | Dongyue | 2018-05-20 |
result=simu_study_basis(mu)
boxplot(result$err)
Version | Author | Date |
---|---|---|
af7fd47 | Dongyue | 2018-05-20 |
range of \(\mu\) roughly \((1,73)\).
r=function(x,c){return((x-c)^2*(x>c)*(x<=1))}
f=function(x){return(0.8 − 30*r(x,0.1) + 60*r(x, 0.2) − 30*r(x, 0.3) +
500*r(x, 0.35) − 1000*r(x, 0.37) + 1000*r(x, 0.41) − 500*r(x, 0.43) +
7.5*r(x, 0.5) − 15*r(x, 0.7) + 7.5*r(x, 0.9))}
mu=f(1:256/256)
mu=mu*120-23
#plot(mu,type = 'l')
result=simu_study_basis(mu)
boxplot(result$err)
Version | Author | Date |
---|---|---|
af7fd47 | Dongyue | 2018-05-20 |
range of \(\mu\) roughly \((1,6)\).
mu=c(rep(1,64), rep(3, 64), rep(6, 64), rep(1, 64))
result=simu_study_basis(mu)
boxplot(result$err)
range of \(\mu\) roughly \((1,80)\).
mu=c(rep(1,64), rep(30, 64), rep(80, 64), rep(1, 64))
result=simu_study_basis(mu)
boxplot(result$err)
range of \(\mu\) roughly \((0.25,6)\).
f=function(x){return(0.5 + 0.2*cos(4*pi*x) + 0.1*cos(24*pi*x))}
mu=f(1:256/256)
mu=mu*10-2
plot(mu,type='l')
result=simu_study_basis(mu)
boxplot(result$err)
range of \(\mu\) roughly \((0.3,75)\).
mu=f(1:256/256)
mu=mu*130-29
#plot(mu,type='l')
result=simu_study_basis(mu)
boxplot(result$err)
range of \(\mu\) roughly \((0.1,6)\).
g=function(x){return((1 − cos(pi*x))/2)}
f=function(x){return(0.3*sin(3*pi*(g(g(g(g(x)))) + x) + 0.5))}
mu=f(1:256/256)
mu=mu*10+3.1
plot(mu,type='l')
result=simu_study_basis(mu)
boxplot(result$err)
range of \(\mu\) roughly \((0.1,120)\).
mu=f(1:256/256)
mu=mu*200+60.1
#plot(mu)
result=simu_study_basis(mu)
boxplot(result$err)
sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] smashrgen_0.1.0 wavethresh_4.6.8 MASS_7.3-47 caTools_1.17.1
[5] ashr_2.2-7 smashr_1.1-5
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 compiler_3.4.0 git2r_0.21.0
[4] workflowr_1.0.1 R.methodsS3_1.7.1 R.utils_2.6.0
[7] bitops_1.0-6 iterators_1.0.8 tools_3.4.0
[10] digest_0.6.13 evaluate_0.10 lattice_0.20-35
[13] Matrix_1.2-9 foreach_1.4.3 yaml_2.1.19
[16] parallel_3.4.0 stringr_1.3.0 knitr_1.20
[19] REBayes_1.3 rprojroot_1.3-2 grid_3.4.0
[22] data.table_1.10.4-3 rmarkdown_1.8 magrittr_1.5
[25] whisker_0.3-2 backports_1.0.5 codetools_0.2-15
[28] htmltools_0.3.5 assertthat_0.2.0 stringi_1.1.6
[31] Rmosek_8.0.69 doParallel_1.0.11 pscl_1.4.9
[34] truncnorm_1.0-7 SQUAREM_2017.10-1 R.oo_1.21.0
This reproducible R Markdown analysis was created with workflowr 1.0.1