Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bbuchsbaum committed Apr 23, 2024
1 parent 83c8217 commit 961b637
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Collate:
'vector_rsa_model.R'
'distcalc.R'
'utils.R'
'feature_rsa_model.R'
RoxygenNote: 7.3.1
Suggests:
testthat,
Expand Down
2 changes: 1 addition & 1 deletion R/mvpa_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ mvpa_model <- function(model,
crossval=crossval,
performance=perf)

class(ret) <- "mvpa_model"
class(ret) <- c("mvpa_model", "model_spec", "list")
ret

}
Expand Down
14 changes: 12 additions & 2 deletions R/rsa_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ rsa_model_mat <- function(rsa_des) {
#'
#' @param dataset An instance of an \code{mvpa_dataset}.
#' @param design An instance of an \code{rsa_design} created by \code{rsa_design()}.
#' @param regtype A character string specifying the analysis method. One of: \code{"pearson"}, \code{"spearman"}, \code{"lm"}, or \code{"rfit"} (defaults to "pearson").
#' @param distmethod A character string specifying the method used to compute distances between observations. One of: \code{"pearson"} or \code{"spearman"} (defaults to "spearman").
#' @param permute A logical indicating whether to permute the data for significance testing (defaults to \code{FALSE}).
#' @return A list with two elements: \code{dataset} and \code{design}, with the class attribute set to \code{"rsa_model"} and \code{"list"}.
#' @examples
#' # Create a random MVPA dataset
Expand All @@ -157,13 +160,20 @@ rsa_model_mat <- function(rsa_des) {
#' # Create an RSA model
#' rsa_mod <- rsa_model(mvpa_data, rdes)
#' @export
rsa_model <- function(dataset, design) {
rsa_model <- function(dataset, design, distmethod=c("pearson", "spearman"), regtype=c("pearson", "spearman", "lm", "rfit"),
permute=FALSE) {
assert_that(inherits(dataset, "mvpa_dataset"))
assert_that(inherits(design, "rsa_design"))

distmethod <- match.arg(distmethod)
regtype <- match.arg(regtype)

# Create an RSA model object with the dataset and design
structure(list(dataset = dataset,
design = design),
design = design,
distmethod=distmethod,
regtype=regtype,
permute=permute),
class = c("rsa_model", "list"))
}

Expand Down

0 comments on commit 961b637

Please sign in to comment.