Skip to content

Commit

Permalink
adding some cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
william-denault committed Aug 19, 2024
1 parent a9d1fdd commit b9d4a98
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 21 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ Suggests:
testthat (>= 3.0.0)
License: BSD_3_clause + file LICENSE
NeedsCompilation: yes
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
ByteCompile: yes
VignetteBuilder: knitr
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(Eloglik,susiF)
S3method(Eloglik,susiF_ss)
S3method(HMM_regression,susiF)
S3method(L_mixsq,mixture_normal)
S3method(L_mixsq,mixture_normal_per_scale)
Expand Down
20 changes: 10 additions & 10 deletions R/ELBO.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ loglik_SFR_post.susiF <- function (obj, l, Y, X, ...)
#
#' @param Y Matrix of outcomes
#
#' @param X Matrix of covariates
#' @param X Matrix of covariates
#'
#' @param data list of data for susif_ss
#' @param \dots Other arguments.
#
#' @return Expected log likelihood
#' @export
Expand All @@ -170,14 +170,14 @@ Eloglik.susiF = function (obj,Y ,X, ...) {

return(-(n*t/2) * log(2*pi*obj$sigma2) - (1/(2*obj$sigma2)) * get_ER2( obj, Y, X))
}
#' @export
#' @keywords internal
Eloglik.susiF_ss = function (obj,data,...) {
n <- data$N
t <- ncol(data$Bhat)

return(-(n*t/2) * log(2*pi*obj$sigma2) - (1/(2*obj$sigma2)) * get_ER2( obj,data))
}
# @export
# @keywords internal
#Eloglik.susiF_ss = function (obj,data,...) {
# n <- data$N
# t <- ncol(data$Bhat)
#
# return(-(n*t/2) * log(2*pi*obj$sigma2) - (1/(2*obj$sigma2)) * get_ER2( obj,data))
#}

#' @title Get objective function from data and susiF object
#
Expand Down
3 changes: 1 addition & 2 deletions R/operation_on_susiF_obj.R
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,6 @@ update_lBF.susiF <- function (obj,l, lBF,...)
#
#' @param Shat matrix pxJ standard error, Shat[j,t] corresponds to standard error of the regression coefficient of Y[,t] on X[,j]
#
#'@param alpha vector of length p, containing the updated log Bayes factors
#'@param indx_lst list generated by gen_wavelet_indx for the given level of resolution
#'@return susiF object
#'@export
Expand Down Expand Up @@ -2070,7 +2069,7 @@ update_residual_variance.susiF <- function( obj,sigma2,...)
#' @param obj a susif object defined by init_susiF_obj function
#' @param min_purity minimal purity within a CS
#' @param X matrix of covariates
#' @param max_crit remove cs base on max absolute correlation instead of min absolute correlation, usefull in the
#' @param median_crit remove cs base on max absolute correlation instead of min absolute correlation, usefull in the
#
#' @return a list of index corresponding the the dummy effect
#
Expand Down
6 changes: 6 additions & 0 deletions R/plot_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ plot_colors <- c("black", "dodgerblue2", "green4", "#6A3D9A", "#FF7F00",
#'
#' @param pip_only logical, if TRUE only ouput the PIP plot
#'
#' @param show_outing_grid logical, if TRUE show grid
#'
#' @param pip_only logical, if TRUE show pip only
#'
#' @param show_affected_region logical, if TRUE show affected regions
#'
#' @param font_size Passed as the \dQuote{ont_size} argument to
#' \code{\link[cowplot]{theme_cowplot}}.
#'
Expand Down
11 changes: 10 additions & 1 deletion R/susiF.R
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
#'
#'out <- susiF(Y,X,L=2 , prior = 'mixture_normal_per_scale')
#'
#'plot_susiF(out, cred.band = TRUE)
#'plot_susiF(out)
#'
#'
#'
Expand Down Expand Up @@ -326,6 +326,15 @@ susiF <- function(Y, X, L = 2,
if(!cal_obj){
tol <-10^-3
}
if(L>ncol(X)){
L <-ncol(X)
}

if(L_start>ncol(X)){
L_start <-ncol(X)
}


if(L_start >L)
{
L_start <- L
Expand Down
2 changes: 1 addition & 1 deletion R/susiF_workhorse.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ susiF.workhorse <- function(obj,
cor_small=FALSE,
is.pois=FALSE,
e = 0.001){

#browser()
G_prior <- get_G_prior(obj )
Y_f <- cbind( W$D,W$C)
update_Y <- Y_f
Expand Down
6 changes: 5 additions & 1 deletion man/fsusie_plots.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/susiF.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions man/update_lfsr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/which_dummy_cs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b9d4a98

Please sign in to comment.