Skip to content

Commit

Permalink
Added some missing S3 methods registrations.
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarbo committed Aug 21, 2023
1 parent 880cad3 commit cba7ded
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions R/igmix.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 3 additions & 0 deletions R/mix.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions R/unimix.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
Expand Down

0 comments on commit cba7ded

Please sign in to comment.