From bda555a418369d9de4ffa8af0b7ec799ffaac7a2 Mon Sep 17 00:00:00 2001 From: Ven Popov Date: Wed, 22 May 2024 21:01:25 +0200 Subject: [PATCH] change class `vwm` to `circular` (#216) --- NAMESPACE | 2 +- R/helpers-data.R | 4 ++-- R/model_imm.R | 2 +- R/model_mixture2p.R | 2 +- R/model_mixture3p.R | 2 +- R/model_sdm.R | 2 +- man/check_data.Rd | 2 +- tests/internal/generate_ref_model_fits_v0.2.1.R | 2 +- vignettes/articles/bmm_bmmformula.Rmd | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 451f4887..f0a3e920 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,12 +7,12 @@ S3method(add_links,bmmfit) S3method(add_links,bmmodel) S3method(bmf2bf,bmmodel) S3method(check_data,bmmodel) +S3method(check_data,circular) S3method(check_data,default) S3method(check_data,imm_bsc) S3method(check_data,imm_full) S3method(check_data,non_targets) S3method(check_data,sdm) -S3method(check_data,vwm) S3method(check_formula,bmmodel) S3method(check_formula,default) S3method(check_formula,non_targets) diff --git a/R/helpers-data.R b/R/helpers-data.R index d49db76d..d952f648 100644 --- a/R/helpers-data.R +++ b/R/helpers-data.R @@ -12,7 +12,7 @@ #' should be defined in the appropriate check_data.* function, where \* #' corresponds to the shared class. For example, for the .model_imm_abc model, #' this corresponds to the following order of check_data.* functions: -#' check_data() -> check_data.vwm(), check_data.non_targets() the output of the +#' check_data() -> check_data.circular(), check_data.non_targets() the output of the #' final function is returned to bmm(). #' @param model A model list object returned from check_model() #' @param data The user supplied data.frame containing the data to be checked @@ -48,7 +48,7 @@ check_data.bmmodel <- function(model, data, formula) { #' @export -check_data.vwm <- function(model, data, formula) { +check_data.circular <- function(model, data, formula) { resp_name <- model$resp_vars[[1]] stopif(not_in(resp_name, colnames(data)), "The response variable '{resp_name}' is not present in the data.") diff --git a/R/model_imm.R b/R/model_imm.R index c1bfa0b3..b94755ba 100644 --- a/R/model_imm.R +++ b/R/model_imm.R @@ -55,7 +55,7 @@ # attributes regex = regex, regex_vars = c('nt_features', 'nt_distances'), - class = c("bmmodel", "vwm", "non_targets", "imm", paste0('imm_',version)), + class = c("bmmodel", "circular", "non_targets", "imm", paste0('imm_',version)), call = call ) diff --git a/R/model_mixture2p.R b/R/model_mixture2p.R index a3ecf4cd..3398e8f8 100644 --- a/R/model_mixture2p.R +++ b/R/model_mixture2p.R @@ -40,7 +40,7 @@ ), void_mu = FALSE ), - class = c("bmmodel", "vwm", "mixture2p"), + class = c("bmmodel", "circular", "mixture2p"), call = call ) out$links[names(links)] <- links diff --git a/R/model_mixture3p.R b/R/model_mixture3p.R index 1a887727..b538d23d 100644 --- a/R/model_mixture3p.R +++ b/R/model_mixture3p.R @@ -51,7 +51,7 @@ # attributes regex = regex, regex_vars = c('nt_features'), - class = c("bmmodel", "vwm", "non_targets", "mixture3p"), + class = c("bmmodel", "circular", "non_targets", "mixture3p"), call = call ) out$links[names(links)] <- links diff --git a/R/model_sdm.R b/R/model_sdm.R index efd4b4a1..92e4c5ce 100644 --- a/R/model_sdm.R +++ b/R/model_sdm.R @@ -38,7 +38,7 @@ ), void_mu = FALSE ), - class = c('bmmodel', 'vwm', 'sdm', paste0("sdm_", version)), + class = c('bmmodel', 'circular', 'sdm', paste0("sdm_", version)), call = call ) out$links[names(links)] <- links diff --git a/man/check_data.Rd b/man/check_data.Rd index 165766e0..eded3966 100644 --- a/man/check_data.Rd +++ b/man/check_data.Rd @@ -30,7 +30,7 @@ they are listed. Thus, any operations that are common to a group of models should be defined in the appropriate check_data.* function, where \* corresponds to the shared class. For example, for the .model_imm_abc model, this corresponds to the following order of check_data.* functions: -check_data() -> check_data.vwm(), check_data.non_targets() the output of the +check_data() -> check_data.circular(), check_data.non_targets() the output of the final function is returned to bmm(). } \keyword{developer} diff --git a/tests/internal/generate_ref_model_fits_v0.2.1.R b/tests/internal/generate_ref_model_fits_v0.2.1.R index 25e53dd5..2f62265d 100644 --- a/tests/internal/generate_ref_model_fits_v0.2.1.R +++ b/tests/internal/generate_ref_model_fits_v0.2.1.R @@ -15,7 +15,7 @@ install_and_load_bmm_version <- function(version) { library(bmm, lib.loc=path) } -# Load data for vwm models (Participant 1-10, SetSize 1-4, from oberauer_lin_2017) +# Load data for circular models (Participant 1-10, SetSize 1-4, from oberauer_lin_2017) # TODO: generalize in the future to allow for different datasets for different models ref_data <- function() { withr::local_package('dplyr') diff --git a/vignettes/articles/bmm_bmmformula.Rmd b/vignettes/articles/bmm_bmmformula.Rmd index dd131cb5..e3fc092e 100644 --- a/vignettes/articles/bmm_bmmformula.Rmd +++ b/vignettes/articles/bmm_bmmformula.Rmd @@ -129,7 +129,7 @@ my_model <- sdm(resp_error = "error") my_model$fixed_parameters ``` -Fixed parameters that can be freely estimated are also listed in the `parameters` of a model, that you can access using `my_model$parameters`. Parameters that are only listed in the `fixed_parameters` but not part of the `parameters` need to be fixed for identification purposes and thus cannot be estimated freely. For example in the `mixture_vwm` models, the location `mu2` and precision `kappa2` of the guessing distributions needs to be fixed for model identification. These parameters are listed in the `fixed_parameters` but not in the `parameters` and therefore cannot be estimated. Only, the internally fixed location of the target responses `mu1` can be estimated freely if needed. +Fixed parameters that can be freely estimated are also listed in the `parameters` of a model, that you can access using `my_model$parameters`. Parameters that are only listed in the `fixed_parameters` but not part of the `parameters` need to be fixed for identification purposes and thus cannot be estimated freely. For example in the `mixture` models for visual working memory, the location `mu2` and precision `kappa2` of the guessing distributions needs to be fixed for model identification. These parameters are listed in the `fixed_parameters` but not in the `parameters` and therefore cannot be estimated. Only, the internally fixed location of the target responses `mu1` can be estimated freely if needed. ```{r} my_model <- mixture2p(resp_error = "error")