Skip to content

Commit

Permalink
version 0.4-0
Browse files Browse the repository at this point in the history
  • Loading branch information
singmann authored and cran-robot committed Mar 28, 2020
1 parent 6ca9327 commit f1c02d1
Show file tree
Hide file tree
Showing 22 changed files with 779 additions and 382 deletions.
17 changes: 9 additions & 8 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: MPTmultiverse
Title: Multiverse Analysis of Multinomial Processing Tree Models
Version: 0.3-3
Version: 0.4-0
Description:
Statistical or cognitive modeling usually requires a number of more or less
arbitrary choices creating one specific path through a 'garden of forking paths'.
Expand All @@ -22,27 +22,28 @@ Authors@R: c(
person("Henrik", "Singmann", role = c("aut", "cre"),
email="singmann@gmail.com", comment=c(ORCID="0000-0002-4842-3657"))
, person(c("Daniel", "W."), "Heck", email = "heck@uni-mannheim.de", role = c("aut"))
, person("Marius", "Barth", email = "marius.barth@uni-koeln.de", role = c("aut"))
, person("Marius", "Barth", email = "marius.barth@uni-koeln.de", role = c("aut"),
comment = c(ORCID = "0000-0002-3421-6665"))
, person("Frederik", "Aust", email = "frederik.aust@uni-koeln.de", role = c("ctb"),
comment = c(ORCID = "0000-0003-4900-788X"))
)
URL: https://github.com/mpt-network/MPTmultiverse
BugReports: https://github.com/mpt-network/MPTmultiverse/issues
Depends: R (>= 2.11.1),
Imports: parallel, magrittr, tidyr, dplyr, tibble, rlang, reshape2,
ggplot2, MPTinR, TreeBUGS, runjags, coda, purrr, readr,
limSolve, utils
ggplot2, MPTinR, TreeBUGS (>= 1.4.4), runjags, coda, purrr,
readr, limSolve, utils
Suggests: knitr, rmarkdown, testthat
LazyData: yes
VignetteBuilder: knitr
RoxygenNote: 6.1.1
RoxygenNote: 7.1.0
License: GPL-2
NeedsCompilation: no
Packaged: 2019-08-27 18:50:43 UTC; henrik
Packaged: 2020-03-27 09:14:02 UTC; henrik
Author: Henrik Singmann [aut, cre] (<https://orcid.org/0000-0002-4842-3657>),
Daniel W. Heck [aut],
Marius Barth [aut],
Marius Barth [aut] (<https://orcid.org/0000-0002-3421-6665>),
Frederik Aust [ctb] (<https://orcid.org/0000-0003-4900-788X>)
Maintainer: Henrik Singmann <singmann@gmail.com>
Repository: CRAN
Date/Publication: 2019-08-27 23:30:29 UTC
Date/Publication: 2020-03-28 01:20:02 UTC
40 changes: 20 additions & 20 deletions MD5
@@ -1,46 +1,46 @@
77a85bb84b0325bbfeaa0d2abd7bf3b1 *DESCRIPTION
e58771c2a4e0a4846830e1c61968e39a *DESCRIPTION
843cf2d97f2f95cdd3b7e728fc64fc68 *NAMESPACE
d939cb647fa698aa12adc75a499907f1 *R/check_results.R
91c72a08fdee06ace9b059741d90413a *R/fit_mpt.R
c43f45d9c8234850f79725c3a9939d6d *NEWS.md
3dcca1b78e32166996c3efd7f59450ce *R/check_results.R
3a65c69a07f7c93481919db6bc1e1ddf *R/fit_mpt.R
a2de0d9664ddbf8e4fa1e7af30b05f3b *R/get_eqn_categories.R
6a0f6bab5550eb15b4b0395fa899042b *R/get_info.R
d8604ad9aa9ca4ecfbb5af1f6747c42a *R/make_results_row.R
28c3dce82255898adca8c906b0f12ffa *R/make_results_row.R
d75725ae664ca9b0860d575356c7e9fe *R/mpt_options.R
57177037d82936fd63d1fff358cc0ea4 *R/mptinr.R
7aa86523c717d54e674c1aa32bff172c *R/mptinr.R
c0860dc3bb02743f1ff358a5c9afed03 *R/onload.R
66b4d99a3e9ec352045eb182827c5766 *R/plot_multiverseMPT.R
faf7d231083e8038c413991ca81d3b2c *R/prep_data_fitting.R
946377fa7e32a9810e3d558556a8ccac *R/treebugs.R
95a46328541e1835c8f31faba95d6f8f *R/treebugs.R
7ba90e1c6fef8537e2ed9d137a801f96 *R/write_results.R
cf1d73fdd11829c6652ca98c8def0c50 *README.md
ca94b68a17030b6e8eaa2d868bfaea95 *build/vignette.rds
5ddc745fc0e241ffe1a2801a5fdf854a *inst/doc/introduction-bayen_kuhlmann_2011.R
4b71a5c606597665434286519a504557 *inst/doc/introduction-bayen_kuhlmann_2011.html
8fb0a3da73fb660d23e6e7fb0b8f1dd8 *inst/doc/introduction-bayen_kuhlmann_2011.rmd
880346b0d7e8d0beb7da9f347de55d93 *README.md
5fe403db3e748972bb3219944b86e8f4 *build/vignette.rds
7bf68aaa17ed61961f91891dd914b15f *inst/doc/introduction-bayen_kuhlmann_2011.R
cf5242568d1f18c48daba9f803b40ba6 *inst/doc/introduction-bayen_kuhlmann_2011.html
a139dc06efc8599d9ab6b0c7f2c88d92 *inst/doc/introduction-bayen_kuhlmann_2011.rmd
378c931503b45c257da3b87e4c5e7490 *inst/extdata/2HTSM_Submodel4.eqn
31de4fabf5cb90e987b2d418a49fed02 *inst/extdata/Kuhlmann_dl7.csv
d9ebea39a1adb10102dbe3cc044395dc *inst/extdata/prospective_memory.eqn
0493e5bef231f7a55d9f2cd2a185d011 *inst/extdata/prospective_memory_example.rda
3acb8d138734233c096e54e6df2c8aa5 *inst/extdata/results_bayen_kuhlmann.RData
16cb443156825bf6684a7a3bc9ce0dcd *inst/extdata/results_bayen_kuhlmann.RData
89b7767efbae5229542389ae6bd07922 *inst/extdata/smith_et_al_2011.csv
b9b0e597e96a6905eb91b6f644f74b95 *man/check_results.Rd
0697cba09eacca908321aaadacbb044b *man/fit_mpt.Rd
78ad955cff0898b16a938ba99927ce61 *man/get_info.Rd
cdb08b7abf35c185d7fed97a48e27b79 *man/fit_mpt.Rd
97423fc2f954472b92d61b707ce62ae3 *man/get_info.Rd
9a3023bfc66e5b420f7df718499fb2fa *man/get_pb_output.Rd
8f3811a251eb5a19d2bbfeea686f1d85 *man/make_results_row.Rd
91e20cb185f30a2236eeb41c8108fb7d *man/mpt_options.Rd
70d444459d24aac210c2b85acb17d520 *man/plot.multiverseMPT.Rd
65b8904cc88c4eea226b24f46b9be466 *man/write_results.Rd
dd4bfb25654cdb367a4c4485a712e332 *tests/testthat.R
910e290d3cec7cc844f69da4a542eb04 *tests/testthat/test-data-structures.R
16a5cbce2a4d7eceb5a9ba2d0cdac561 *tests/testthat/test-identifiability_checks.R
c04b39aa866ac729df2bf88ddf48c8f0 *tests/testthat/test-data-structures.R
a60c7e95ba346696712f855ff9673d83 *tests/testthat/test-identifiability_checks.R
e72d9c5908546dac0b22cc760890a110 *tests/testthat/test-mpt_options.R
5ffa69e5d65eafdb821e38afd37c70e3 *tests/testthat/test-mptinr.R
15b9a91654c2a73e11ff9b74ca2b83e8 *tests/testthat/test_treebugs.R
25031aa67bff49b704a2e2a63919b4ce *tests/testthat/test-mptinr.R
a5cb9755b915c3c67004fe4301df96f5 *tests/testthat/test_treebugs.R
7e3b16937fce40bab6396676351497c7 *vignettes/NOT_USED/1_bayen_kuhlmann_2011.html
378c931503b45c257da3b87e4c5e7490 *vignettes/NOT_USED/2HTSM_Submodel4.eqn
dd5449a91eba16200d402dbf928414c2 *vignettes/NOT_USED/2_Smith_et_al_2011.rmd
31de4fabf5cb90e987b2d418a49fed02 *vignettes/NOT_USED/Kuhlmann_dl7.csv
d9ebea39a1adb10102dbe3cc044395dc *vignettes/NOT_USED/prospective_memory.eqn
89b7767efbae5229542389ae6bd07922 *vignettes/NOT_USED/smith_et_al_2011.csv
8fb0a3da73fb660d23e6e7fb0b8f1dd8 *vignettes/introduction-bayen_kuhlmann_2011.rmd
a139dc06efc8599d9ab6b0c7f2c88d92 *vignettes/introduction-bayen_kuhlmann_2011.rmd
16 changes: 16 additions & 0 deletions NEWS.md
@@ -0,0 +1,16 @@

# MPTmultiverse 0.4-0

- Added a `NEWS.md` file to track changes to the package.
- Added within-subjects comparisons of parameter estimates that are stored in column
`test_within` of the results object.
- For the Bayesian methods, these comparisons rely on posterior distributions
of parameter differences.
- For the no-pooling maximum-likelihood methods, comparisons rely on paired *t* tests.
- For the complete-pooling maximum-likelihood method, comparisons rely on the the point estimates
of parameters and the estimates of the standard errors of differences calculated
from the Hessian matrix.
- Changed the default behavior for auto-extending Bayesian models: As of now, chains
are only combined if Rhat <= Rhat_max*2-1. An informative message is printed whether chains were
combined with earlier draws or not.
- Prepared `MPTmultiverse` for new `tibble` version.
16 changes: 8 additions & 8 deletions R/check_results.R
Expand Up @@ -64,17 +64,17 @@ check_results <- function(results) {

not_id <- results %>%
dplyr::filter(.data$package == "MPTinR" & .data$pooling == "no" & .data$method == meth) %>%
dplyr::select("est_indiv") %>%
tidyr::unnest() %>%
dplyr::select(.data$est_indiv) %>%
tidyr::unnest(.data$est_indiv) %>%
dplyr::group_by(.data$condition, .data$core) %>%
dplyr::summarise(proportion = mean(!.data$identifiable |
is.na(.data$identifiable))) %>%
dplyr::ungroup()

not_id2 <- results %>%
dplyr::filter(.data$package == "MPTinR" & .data$pooling == "no" & .data$method == meth) %>%
dplyr::select("est_indiv") %>%
tidyr::unnest() %>%
dplyr::select(.data$est_indiv) %>%
tidyr::unnest(.data$est_indiv) %>%
dplyr::filter(!.data$identifiable) %>%
dplyr::group_by(.data$condition, .data$core, .data$parameter) %>%
dplyr::count() %>%
Expand Down Expand Up @@ -105,8 +105,8 @@ check_results <- function(results) {
tryCatch({
conv_mptinr_comp <- results %>%
dplyr::filter(.data$package == "MPTinR" & .data$pooling == "complete") %>%
dplyr::select("convergence") %>%
tidyr::unnest()
dplyr::select(.data$convergence) %>%
tidyr::unnest(.data$convergence)

comp_prob <- (conv_mptinr_comp$convergence != 0) |
(conv_mptinr_comp$rank.fisher != conv_mptinr_comp$n.parameters)
Expand All @@ -128,13 +128,13 @@ check_results <- function(results) {
### TreeBUGS
res_tree <- results %>%
dplyr::filter(.data$package == "TreeBUGS") %>%
dplyr::select(!!c("model", "dataset", "pooling", "package", "method", "convergence", "est_group"))
dplyr::select(.data$model, .data$dataset, .data$pooling, .data$package, .data$method, .data$convergence, .data$est_group)

for (i in seq_len(nrow(res_tree))) {
cat("## ", paste(res_tree[i, 1:5], collapse = " // "), ":\n", sep = "")

params <- res_tree[i,] %>%
tidyr::unnest(.data$est_group) %>%
tidyr::unnest(cols = .data$est_group) %>%
dplyr::select(.data$parameter, .data$core)

tmp_convergence <- res_tree[i, ]$convergence[[1]] %>%
Expand Down
33 changes: 20 additions & 13 deletions R/fit_mpt.R
Expand Up @@ -62,12 +62,9 @@
#' the data has more than one between-subjects condition, these need to be
#' combined into one condition for this function.
#'
#' Parameter differences or other support for within-subject conditions is not
#' provided. The best course of action for within-subjects conditions is to
#' simply include separate trees and separate sets of parameters for each
#' within-subjects condition. This allows to at least compare the estimates
#' for each within-subjects condition across levels of pooling and estimation
#' methods.
#' To include multiple within-subjects conditions, include separate trees and
#' separate sets of parameters for each within-subjects condition in your
#' .eqn file.
#'
#' \subsection{Pooling}{
#' The following pooling levels are provided (not all by all estimation approaches, see below).
Expand Down Expand Up @@ -128,8 +125,11 @@
#' For the \emph{complete pooling asymptotic approach}, the group-level parameter
#' estimates and goodness-of-fit statistics are the maximum-likelihood and
#' G-squared values returned by \code{MPTinR}. The parameter differences are
#' based on these values, the standard errors of the difference is simply
#' the pooled standard error of the individual parameters. The overall fit
#' based on these values. for between-subjects comparisons, the standard
#' errors of the differences are simply the pooled standard error of the
#' individual parameters; for within-subjects comparisons, the standard errors
#' of the differences are based on the respective linear transform of the estimated
#' variance-covariance matrix calculated from the Hessian matrix. The overall fit
#' (column \code{gof}) is based on an additional fit to the completely
#' aggregated data.
#'
Expand All @@ -153,7 +153,9 @@
#' statistics are based on a t-test comparing the individual-level estimates
#' (again, after excluding non-identifiable estimates). The CIs of the
#' difference are based on the SEs (which are derived from a linear model
#' equivalent to the t-test).
#' equivalent to the t-test). Within-subjects comparisons are based on t-tests
#' for paired observations.
#'
#'
#' The individual-level estimates of the \code{bootstrap based no-pooling}
#' approaches are identical to the asymptotic ones. However, the SE is the
Expand All @@ -167,9 +169,9 @@
#' \code{mpt_options()$max_ci_indiv}, which defaults to \code{0.99}. Thus,
#' in the default settings we say a parameter is non-identifiable if the
#' bootstrap based CI extends from 0 to 1. The group-level estimates are the
#' mean of the identifiable individual-level estimates. And difference
#' between conditions is calculated in the same manner as for the asymptotic
#' case using the identifiable individual-level parameter esatimates.
#' mean of the identifiable individual-level estimates. The difference
#' between conditions (as well as within conditions) is calculated in the same manner as for the asymptotic
#' case using the identifiable individual-level parameter estimates.
#' }
#'
#' \subsection{Bayesian Methods}{
Expand All @@ -194,7 +196,7 @@
#' For all Bayesian methods, the posterior distribution of the parameters is
#' summarized by the posterior mean (in the column \code{est}), posterior
#' standard deviation (\code{se}), and credbility intervals (\code{ci_*}).
#' For parameter differences (\code{test_between}) and correlations
#' For parameter differences (\code{test_between} and \code{test_within}) and correlations
#' (\code{est_rho}), Bayesian p-values are computed (column \code{p}) by
#' counting the relative proportion of posterior samples that are smaller
#' than zero. Goodness of fit is tested with the T1 statistic
Expand Down Expand Up @@ -224,6 +226,7 @@
#' on the probit scale (only in \code{method="trait"}).
#' \item \code{test_between}: Parameter differences between the levels of the
#' between-subjects condition (if specified).
#' \item \code{test_within}: Within-subjects parameter differences.
#' \item \code{gof}: Overall goodness of fit across all individuals.
#' \item \code{gof_group}: Group-level goodness of fit.
#' \item \code{gof_indiv}: Individual-level goodness of fit.
Expand Down Expand Up @@ -326,6 +329,10 @@ fit_mpt <- function(
data$ExpCond <- as.character(data[[condition]])
data$Subject <- as.character(data[[id]])

if(any(duplicated(data$Subject))) {
stop("Multiple rows per subject in data. Ensure that the subject identifier is properly specified and you correctly aggregated your data.")
}


# check MPT file
mpt_model <- TreeBUGS::readEQN(model)
Expand Down

0 comments on commit f1c02d1

Please sign in to comment.