diff --git a/DESCRIPTION b/DESCRIPTION index 5a56a9c..c138391 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,7 +13,7 @@ Authors@R: c(person("Matthew","Stephens",role="aut", person("Jason","Willwerscheid",role="aut"), person("Nan","Xiao",role="aut"), person("Mazon","Zeng",role="ctb")) -Version: 2.2-62 +Version: 2.2-63 Date: 2023-08-21 Title: Methods for Adaptive Shrinkage, using Empirical Bayes Description: The R package 'ashr' implements an Empirical Bayes diff --git a/NAMESPACE b/NAMESPACE index d7aed9f..151f8fe 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +S3method(calc_mixsd,default) S3method(cdf_post,default) S3method(comp_cdf,default) S3method(comp_cdf,igmix) @@ -16,6 +17,7 @@ S3method(comp_dens,default) S3method(comp_dens,igmix) S3method(comp_dens,normalmix) S3method(comp_dens,tnormalmix) +S3method(comp_dens,unimix) S3method(comp_dens_conv,tnormalmix) S3method(comp_dens_conv,unimix) S3method(comp_mean,default) @@ -38,8 +40,10 @@ S3method(comp_postsd,igmix) S3method(comp_postsd,normalmix) S3method(comp_postsd,tnormalmix) S3method(comp_sd,default) +S3method(comp_sd,igmix) S3method(comp_sd,normalmix) S3method(comp_sd,tnormalmix) +S3method(comp_sd,unimix) S3method(dens,default) S3method(log_comp_dens_conv,tnormalmix) S3method(loglik_conv,default) diff --git a/R/igmix.R b/R/igmix.R index a787d77..7ea10e5 100644 --- a/R/igmix.R +++ b/R/igmix.R @@ -22,6 +22,7 @@ igmix = function(pi,alpha,beta){ structure(data.frame(pi,alpha,beta),class="igmix") } +#' @export comp_sd.igmix = function(m){ m$beta/(m$alpha-1)/sqrt(m$alpha-2) } diff --git a/R/mix.R b/R/mix.R index a3ea946..0f457ff 100644 --- a/R/mix.R +++ b/R/mix.R @@ -87,10 +87,13 @@ mixmean2.default = function(m){ #' @param m a mixture of k components generated by normalmix() or #' unimix() or igmix() #' @return it returns scalar +#' #' @export +#' calc_mixsd = function(m){ UseMethod("calc_mixsd") } +#' @export calc_mixsd.default = function(m){ sqrt(mixmean2(m)-calc_mixmean(m)^2) } diff --git a/R/unimix.R b/R/unimix.R index f7e2ee5..bbb9ae4 100644 --- a/R/unimix.R +++ b/R/unimix.R @@ -27,6 +27,7 @@ comp_cdf.unimix = function(m,y,lower.tail=TRUE){ vapply(y,stats::punif,m$a,min=m$a,max=m$b,lower.tail) } +#' @export comp_sd.unimix = function(m){ (m$b-m$a)/sqrt(12) } @@ -36,8 +37,7 @@ comp_mean.unimix = function(m){ (m$a+m$b)/2 } - - +#' @export comp_dens.unimix = function(m,y,log=FALSE){ k=ncomp(m) n=length(y)