regression_data.R
implements several classes for different input data types and relevant algebraic operations on them.Implementation of SuSiE model falls roughly in the structure of the SuSiE manuscript. That is, we introduce Bayesian regression model, followed by Single Effect Regression (SER), and finally the SuSiE model. Implementation-wise,
*_regression.R
implements several classes for Bayesian regression models using different priors.single_effect_model.R
implements the SER model. It inherits Bayesian regression models.ibss_algorithm.R
implements the IBSS algorithm for SuSiE model.mvsusie.R
implements interface mvsusie()
function.utils.R
contains some utility functions.R6
classR6
is pretty easy to learn just by the length of its documentation.
A couple of quick pointers on R6
class if you don't want to bother reading its documentation:
private$<name>
refers to private member (ie, variable) or method (ie, function); convention self$<name>
refers to public member or method, or, active bindings. Please be careful which to use.A
to set B
via B=A
then modify B
, you will also be modifying A
! To prevent this from happening you've got to use this: B=A$clone(deep=TRUE)
.A2
is inherited from A1
, and suppose a
is an instance of A2
, then both inherits(a, "A2")
and inherits(a, "A1")
will be true. If a
is instance of A1
then only the latter is true.private
cannot have same name as public
and active
.private$
and self$
can have some overhead which can be substential for some applications. I therefore use portable=FALSE
and use <<-
for class member assignment.I use the following convention in my code:
public
member variable. All variables are private.active
.function()
; an attempt to assign values to them will raise an error.function(v)
..<name>
and the corresponding exposed variable will be <name>
if exposed to active
.Otherwise, the only downside as I found using R6
is that the trace back for errors is not as clear as without using it. But R language in general doesn't have good error trace back (compared to Python which can point to you the exact lines of codes that are problematic), so R6
is not making it that much worse.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.