Skip to content

Commit

Permalink
version 1.0-2
Browse files Browse the repository at this point in the history
  • Loading branch information
singmann authored and cran-robot committed Jul 3, 2024
1 parent 0cfe288 commit 70b4e2b
Show file tree
Hide file tree
Showing 15 changed files with 574 additions and 512 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: fddm
Type: Package
Title: Fast Implementation of the Diffusion Decision Model
Version: 1.0-1
Version: 1.0-2
Authors@R: c(person(given="Kendal B.", family="Foster", role=c("aut")),
person(given="Henrik", family="Singmann", role=c("ctb", "cre"),
email="singmann@gmail.com", comment=c(ORCID="0000-0002-4842-3657")),
Expand Down Expand Up @@ -34,10 +34,10 @@ RoxygenNote: 7.3.1
Encoding: UTF-8
VignetteBuilder: knitr
NeedsCompilation: yes
Packaged: 2024-06-25 21:31:25 UTC; kendal
Packaged: 2024-07-01 13:22:08 UTC; kendal
Author: Kendal B. Foster [aut],
Henrik Singmann [ctb, cre] (<https://orcid.org/0000-0002-4842-3657>),
Achim Zeileis [ctb] (methods partially taken from betareg)
Maintainer: Henrik Singmann <singmann@gmail.com>
Repository: CRAN
Date/Publication: 2024-06-26 10:00:02 UTC
Date/Publication: 2024-07-02 16:00:07 UTC
28 changes: 14 additions & 14 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
b62e0c69338ef4ac9d402683173767fb *DESCRIPTION
e46bdb11849c6c7cad35eb03911e3191 *DESCRIPTION
8e8d6c9696aede51b3bca9ee8aad7b0a *NAMESPACE
4613b23fc793986a9e59138f32319cc7 *NEWS.md
bf33e8002ba557820400178354276ef9 *NEWS.md
c528b94d0f1a1a807a0b47ec395acb41 *R/RcppExports.R
2ab812085de2cd93b2f1abafa75c017e *R/ddm.R
287b564585a941e0407d969fa721e5b3 *R/ddm.R
f28b468ce60138c5e703e7d638276721 *R/ddm_fit.R
ce2ae9476bbe360ad4cc9ca296d44ecc *R/ddm_methods.R
210e2e683a2f9f775c826f1b9667cdad *R/ezddm.R
Expand All @@ -11,24 +11,24 @@ cb347141114c84f4862ad52796ac145a *R/zzz.R
68ff6967f3ef1fa621cdc91262276583 *README.md
f72adcfe654c67199a67ff3009d0dea4 *build/vignette.rds
4a4e6d0687893e296ee48f6bf98afcb9 *data/med_dec.rda
2d34e2af05b704d25dcd2a3e42d72090 *inst/doc/benchmark.R
e470c5553c8de4e681c11db4e527c6ac *inst/doc/benchmark.Rmd
2b172be18ecc8805d94bee5cd8435438 *inst/doc/benchmark.html
4b175b4bbe41058e79a4c9eec78858e6 *inst/doc/benchmark.R
af30c9fd22fe993715496ca33957ae41 *inst/doc/benchmark.Rmd
96d2b5ff4ce16a152c266f2af53a9612 *inst/doc/benchmark.html
c319c51b652bd551bad2acd79f60bb90 *inst/doc/example.R
62530070e635b05f56c2b7d2bdf3d1b4 *inst/doc/example.Rmd
001644f8d24ee1ecd583aaca91899fee *inst/doc/example.html
3b22131b75e34d33ceaa7b6373a202c8 *inst/doc/example.html
3ac1b1f60328d4b40b7a7d5e52a3b536 *inst/doc/math.R
2bc5251aafb770c4e182ccda641be831 *inst/doc/math.Rmd
6b5e6a6e532205dadd347bfcbd4177bc *inst/doc/math.html
2179010ff5f08c10c6ba114c734b0031 *inst/doc/math.html
55ae9ede4941bbbb534a2da11d00b479 *inst/doc/pfddm.R
7f451169c7862eeb5ec7bfc18f734d66 *inst/doc/pfddm.Rmd
fecfaaffb6143d80b58dfbdce2f4aee0 *inst/doc/pfddm.html
568000cf860c04127dde8c60a83a6d4d *inst/doc/pfddm.html
8d9aee483b9d0d10863780dc2a379640 *inst/doc/validity.R
83b2259ea70373487a1e293b1dddcb31 *inst/doc/validity.Rmd
c813aec38afc0ef2789b721fb62bd002 *inst/doc/validity.html
927ae1a483ead05f25a4875416c06974 *inst/doc/validity.html
a234af19ac3f07ec131283aae640dd60 *inst/extdata/Blurton_et_al_distribution.R
77689a069eb388eaf5ee77c85eb87c12 *inst/extdata/Gondan_et_al_density.R
01bd679f6e22788ce410af8231d2d1b0 *inst/extdata/dfddm_density/bm_fit.Rds
0355f2ed0f78d5fc419f97b0b70b6f37 *inst/extdata/dfddm_density/bm_fit.Rds
86d1e242ff328d55ce93e0d986a794e5 *inst/extdata/dfddm_density/bm_ind_0-2.Rds
a2a4facb7b086bf413dbb23b410322ac *inst/extdata/dfddm_density/bm_vec_0-2.Rds
9899ed900551ea908ff349a60d33b105 *inst/extdata/dfddm_density/valid_fit.Rds
Expand All @@ -37,7 +37,7 @@ c6fc34da01172945cf1fa9c84da9ab92 *inst/extdata/pfddm_distribution/bm_vec_0-2.Rds
c9a1462e01d8a4d4060a6fd3b893c6cc *man/da2_dfddm.Rd
3bf6a69b934ee35d0bc884ef4ff312af *man/da_dfddm.Rd
520ecb77f83734f4c7429dc88cabdce4 *man/ddm-methods.Rd
30aa0829bc5e403eb1e17ff0bea2e0a2 *man/ddm.Rd
4b51d47a8ed14bae5f1af9b03d194891 *man/ddm.Rd
4fdcb824dd18bb8ffa726c9118716d48 *man/dfddm.Rd
cccc6c62b8da26d6880ac26e8f935480 *man/dsv2_dfddm.Rd
6c8a523dd1a4473c5e0f9780ef7fd3b3 *man/dsv_dfddm.Rd
Expand Down Expand Up @@ -77,7 +77,7 @@ e0770af8f95f55db5f2ff2612c413636 *src/helper_functions/fitting/num_funcs.cpp
a0e76f780eaaf1bca49a70887d2d49a5 *src/helper_functions/fitting/partial_decs.h
14e5cf8647b1ba2cb33520d3702d0580 *src/helper_functions/fitting/partial_deriv_funcs.cpp
1921b2a38ea4a086a25f48dd883bdcd8 *src/helper_functions/fitting/second_order_partial_deriv_funcs.cpp
5863669e716bc8b347bfffc3fd15b7c8 *src/helper_functions/fitting/sum_funcs.cpp
9a1091869e0e36e905cf606d1d698307 *src/helper_functions/fitting/sum_funcs.cpp
91b24edc26ffe15b13677398f9e87080 *src/helper_functions/parameter_checks.cpp
5c73911508113c72df6978b00aed93e1 *src/helper_functions/parameter_checks.h
3bc1a9006017647b25c14fa5dfdd3322 *src/pfddm.cpp
Expand All @@ -89,7 +89,7 @@ eb06e8e980d6ccb9be157e8f7d15e842 *tests/testthat/test-parameter-checks.R
91b03989b1e3d74ebae92db81003638d *tests/testthat/test-partial-derivatives.R
2634ba9b6319dd63737a1799ba70d76f *tests/testthat/test-second-order-partial-derivatives.R
2fde2e185bde1da6fad6eacda939e1a4 *tests/testthat/test-validity_vignette_fits.R
e470c5553c8de4e681c11db4e527c6ac *vignettes/benchmark.Rmd
af30c9fd22fe993715496ca33957ae41 *vignettes/benchmark.Rmd
62530070e635b05f56c2b7d2bdf3d1b4 *vignettes/example.Rmd
2bc5251aafb770c4e182ccda641be831 *vignettes/math.Rmd
7f451169c7862eeb5ec7bfc18f734d66 *vignettes/pfddm.Rmd
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# fddm v1.0-1 (Release date: 2024-06-26)
# fddm v1.0-2 (Release date: 2024-06-26)

## New Features
* added function `ddm()` which permits formula-based fitting of the DDM using the analytic gradient.
Expand Down
6 changes: 3 additions & 3 deletions R/ddm.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@
#' parameter was estimated with a single coefficient; \code{0}
#' indicates that the model parameter was fixed)
#' \item \code{na.action} na.action
#' \item \code{terms} a named list whose elements are , and whose last
#' element is named \code{full} and shows the breakdown of the model
#' with all model parameters
#' \item \code{terms} a named list whose elements are the model parameters,
#' except the last element is named \code{full} and shows the
#' breakdown of the model with all model parameters
#' \item \code{levels} a named list whose elements are the levels associated
#' with any parameters that are factors (the elements are \code{NULL}
#' if the parameter is not a factor), and whose last element is named
Expand Down
56 changes: 37 additions & 19 deletions inst/doc/benchmark.R
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ ll_RTDists <- function(pars, rt, resp, truth) {
## ----fit-fun------------------------------------------------------------------
rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
truth_idx = NULL, response_upper = NULL, err_tol = 1e-6,
ctrl_list = list(eval.max = 1000, iter.max = 1000),
times = 100, unit = "ns") {

# Format data for fitting
Expand All @@ -622,9 +623,9 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
stringsAsFactors = FALSE)

if (!is.null(id_idx)) { # relabel identification tags
for (i in 1:length(id_idx)) {
for (i in seq_along(id_idx)) {
idi <- unique(data[,id_idx[i]])
for (j in 1:length(idi)) {
for (j in seq_along(idi)) {
df[["id"]][data[,id_idx[i]] == idi[j]] <- paste(
df[["id"]][data[,id_idx[i]] == idi[j]], idi[j], sep = " ")
}
Expand Down Expand Up @@ -693,7 +694,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+0*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+0*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+0*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -703,7 +705,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+1*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+1*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+1*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -712,7 +715,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+2*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+2*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+2*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -722,7 +726,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+3*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+3*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+3*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -732,7 +737,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+4*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+4*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+4*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -742,7 +748,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+5*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+5*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+5*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -752,7 +759,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+6*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+6*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+6*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -762,7 +770,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+7*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+7*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+7*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -772,7 +781,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+8*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+8*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+8*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -782,7 +792,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+9*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+9*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+9*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -792,7 +803,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+10*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+10*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+10*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -802,7 +814,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+11*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+11*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+11*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -812,7 +825,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+12*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+12*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+12*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -822,7 +836,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+13*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+13*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+13*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -832,7 +847,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi, err_tol = err_tol,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+14*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+14*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+14*ninit_vals+j] <- temp[["iterations"]]
Expand All @@ -842,7 +858,8 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
rt = rti, resp = respi, truth = truthi,
# limits: vu, vl, a, t0, w, sv
lower = c(-Inf, -Inf, .01, 0, 0, 0),
upper = c( Inf, Inf, Inf, min_rti, 1, Inf))
upper = c( Inf, Inf, Inf, min_rti, 1, Inf),
control = ctrl_list)
res[["Convergence"]][(i-1)*ni+15*ninit_vals+j] <- temp[["convergence"]]
res[["Objective"]][(i-1)*ni+15*ninit_vals+j] <- temp[["objective"]]
res[["Iterations"]][(i-1)*ni+15*ninit_vals+j] <- temp[["iterations"]]
Expand Down Expand Up @@ -946,11 +963,12 @@ rt_fit <- function(data, id_idx = NULL, rt_idx = NULL, response_idx = NULL,
# med_dec <- med_dec[which(med_dec[["rt"]] >= 0), ]
# fit <- rt_fit(med_dec, id_idx = c(2,1), rt_idx = 8, response_idx = 7,
# truth_idx = 5, response_upper = "blast", err_tol = 1e-6,
# ctrl_list = list(eval.max = 10000, iter.max = 10000),
# times = 5, unit = "ns")

## ----fit-run-save, eval=FALSE, include=FALSE----------------------------------
# save(fit, compress = "xz", compression_level = 9,
# file = "inst/extdata/bm_fit.Rds")
# file = "inst/extdata/dfddm_density/bm_fit.Rds")

## ----fit-packages-------------------------------------------------------------
library("reshape2")
Expand Down
Loading

0 comments on commit 70b4e2b

Please sign in to comment.