Last updated: 2018-05-13
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: 665a2d2
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/poiunknown.Rmd
Unstaged changes:
Modified: analysis/ashpmean.Rmd
Modified: analysis/index.Rmd
Modified: analysis/nugget.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.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 665a2d2 | Dongyue | 2018-05-13 | estiamte unknown sigma |
From the comparisons for estimating unknown \(\sigma\), the ols and smash verison of method 4 perform uniformly better. To deal with case when both \(\mu_t\) and \(\sigma\) are unknown in the model \(Y_t=\mu_t+N(0,\sigma^2)+N(0,s_t^2)\), we adopt the iterative algorithm in Xing\(\&\)Stephens(2016). We initialize \(\hat\sigma^2=\frac{1}{T}\Sigma_t^T\{((Y_t-Y_{t+1})^2+(Y_t-Y_{t+1})^2-2s_t^2-s_{t-1}^2-s_{t+1}^2)/4\}\).
#' function to estimate both mu and \sigma
#' @param x:data
smash.gaus.gen=function(x,st,family='DaubExPhase',niters=2,method='smashc'){
#initialize \sigma^2
sigma0=sigma_est(x,st=st,method = 'moment')
#sd0=sqrt(sigma0^2+st^2)
sd.est=c()
mu.est=c()
sd.est=c(sd.est,sigma0)
for(iter in 1:niters){
#estimate mu given sd
mu.hat=smash.gaus(x,sigma=sqrt(sd.est[iter]^2+st^2),family=family)
mu.est=rbind(mu.est,mu.hat)
#estimate sd given mu
sd.hat=sigma_est(x,mu.est[iter,],st,method=method)
sd.est=c(sd.est,sd.hat)
}
#mu.hat=smash.gaus(x,sigma=sqrt(sd.hat^2+st^2),family=family)
return(list(mu.hat=mu.hat,sd.hat=sd.hat))
}
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
loaded via a namespace (and not attached):
[1] workflowr_1.0.1 Rcpp_0.12.16 digest_0.6.13
[4] rprojroot_1.3-2 R.methodsS3_1.7.1 backports_1.0.5
[7] git2r_0.21.0 magrittr_1.5 evaluate_0.10
[10] stringi_1.1.6 whisker_0.3-2 R.oo_1.21.0
[13] R.utils_2.6.0 rmarkdown_1.8 tools_3.4.0
[16] stringr_1.3.0 yaml_2.1.19 compiler_3.4.0
[19] htmltools_0.3.5 knitr_1.20
This reproducible R Markdown analysis was created with workflowr 1.0.1