danheck / treebugs Goto Github PK
View Code? Open in Web Editor NEWR package for fitting hierarchical multinomial processing tree (MPT) models
R package for fitting hierarchical multinomial processing tree (MPT) models
I was working through the tutorial from the paper that introduces the package. Looking at the data used I noticed all the participants had same number of trials (64). Will the different number of trials in total effect the reliability of the MPT or it will work fine even when the total numbers of trials is different for each subject?
Hi,
I believe I was using this in a previous R version and it was working. I revisited TreeBugs and now when I use the following argument.
getSamples(fittedModel, parameter = "theta")
Returns the following error:
Error in
[.default(x[[k]], , j, drop = drop) : subscript out of bounds
This prevents me from extracting all individual-level parameters. I believe this is a recent issue.
Hi Daniel,
I think I encountered a bug in the PPP()
function. Applying PPP() to a traitMPT results in the following error message. If you have an idea how to easily fix it, let me know. I will try to take a look into it this weekend.
Best regards,
Marius
PPP(mpt_model)
Fehler in checkForRemoteErrors(val) :
4 nodes produced errors; first error: Indizierung außerhalb der Grenzen
9. stop(count, " nodes produced errors; first error: ", firstmsg,
domain = NA)
8. checkForRemoteErrors(val)
7. staticClusterApply(cl, fun, length(x), argfun)
6. clusterApply(cl = cl, x = splitList(X, nchunks), fun = lapply, FUN = fun, ...)
5. do.call(c, clusterApply(cl = cl, x = splitList(X, nchunks), fun = lapply, FUN = fun, ...), quote = TRUE)
4. parLapply(cl = cl, X = arglist, fun = FUN, ..., chunk.size = chunk.size)
3. parApply(cl, cbind(par.thetaFE, par.ind), 1, getPostPred) at posteriorPredictive.R#177
2. posteriorPredictive(fittedModel, M, expected = TRUE, nCPU = nCPU) at PPP.R#29
1. PPP(mpt_model)
My session info:
> devtools::session_info()
─ Session info ────────────────────────────────────────────────────────────
setting value
version R version 3.6.3 (2020-02-29)
os Ubuntu 16.04.6 LTS
system x86_64, linux-gnu
ui RStudio
language de_DE
collate de_DE.UTF-8
ctype de_DE.UTF-8
tz Europe/Berlin
date 2020-05-14
─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date lib source
abind 1.4-5 2016-07-21 [1] CRAN (R 3.6.0)
afex * 0.27-2 2020-03-28 [1] CRAN (R 3.6.3)
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0)
backports 1.1.6 2020-04-05 [1] CRAN (R 3.6.3)
BayesFactor * 0.9.12-4.2 2018-05-19 [1] CRAN (R 3.6.0)
beeswarm 0.2.3 2016-04-25 [1] CRAN (R 3.6.0)
boot 1.3-25 2020-04-26 [4] CRAN (R 3.6.3)
broom 0.7.0.9000 2020-05-12 [1] Github (mariusbarth/broom@c878e6d)
callr 3.4.3 2020-03-28 [1] CRAN (R 3.6.3)
car 3.0-7 2020-03-11 [1] CRAN (R 3.6.3)
carData 3.0-3 2019-11-16 [1] CRAN (R 3.6.1)
cellranger 1.1.0 2016-07-27 [1] CRAN (R 3.6.0)
cli 2.0.2 2020-02-28 [1] CRAN (R 3.6.3)
coda * 0.19-3 2019-07-05 [1] CRAN (R 3.6.0)
codetools 0.2-16 2018-12-24 [4] CRAN (R 3.5.2)
colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.6.0)
contfrac 1.1-12 2018-05-17 [1] CRAN (R 3.6.0)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0)
curl 4.3 2019-12-02 [1] CRAN (R 3.6.1)
data.table 1.12.8 2019-12-09 [1] CRAN (R 3.6.1)
DBI 1.1.0 2019-12-15 [1] CRAN (R 3.6.1)
dbplyr 1.4.3 2020-04-19 [1] CRAN (R 3.6.3)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.0)
deSolve 1.28 2020-03-08 [1] CRAN (R 3.6.3)
devtools 2.3.0 2020-04-10 [1] CRAN (R 3.6.3)
digest 0.6.25 2020-02-23 [1] CRAN (R 3.6.3)
dplyr * 0.8.99.9003 2020-05-12 [1] Github (tidyverse/dplyr@d2627f7)
ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.1)
elliptic 1.4-0 2019-03-14 [1] CRAN (R 3.6.0)
emmeans * 1.4.6 2020-04-19 [1] CRAN (R 3.6.3)
estimability 1.3 2018-02-11 [1] CRAN (R 3.6.0)
fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.1)
farver 2.0.3 2020-01-16 [1] CRAN (R 3.6.3)
forcats * 0.5.0 2020-03-01 [1] CRAN (R 3.6.3)
foreign 0.8-76 2020-03-03 [4] CRAN (R 3.6.3)
fs 1.4.1 2020-04-04 [1] CRAN (R 3.6.3)
generics 0.0.2 2018-11-29 [1] CRAN (R 3.6.0)
ggplot2 * 3.3.0 2020-03-05 [1] CRAN (R 3.6.3)
glue 1.4.1 2020-05-13 [1] CRAN (R 3.6.3)
gtable 0.3.0 2019-03-25 [1] CRAN (R 3.6.0)
gtools 3.8.2 2020-03-31 [1] CRAN (R 3.6.3)
haven 2.2.0 2019-11-08 [1] CRAN (R 3.6.1)
highr 0.8 2019-03-20 [1] CRAN (R 3.6.0)
hms 0.5.3 2020-01-08 [1] CRAN (R 3.6.1)
httr 1.4.1 2019-08-05 [1] CRAN (R 3.6.1)
hypergeo 1.2-13 2016-04-07 [1] CRAN (R 3.6.0)
jsonlite 1.6.1 2020-02-02 [1] CRAN (R 3.6.3)
knitr 1.28 2020-02-06 [1] CRAN (R 3.6.3)
labeling 0.3 2014-08-23 [1] CRAN (R 3.6.0)
latex2exp 0.4.0 2015-11-30 [1] CRAN (R 3.6.0)
lattice 0.20-41 2020-04-02 [1] CRAN (R 3.6.3)
lifecycle 0.2.0 2020-03-06 [1] CRAN (R 3.6.3)
lme4 * 1.1-23 2020-04-07 [1] CRAN (R 3.6.3)
lmerTest 3.1-2 2020-04-08 [1] CRAN (R 3.6.3)
logspline 2.1.16 2020-05-08 [1] CRAN (R 3.6.3)
lubridate 1.7.8 2020-04-06 [1] CRAN (R 3.6.3)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.0)
MASS 7.3-51.6 2020-04-26 [4] CRAN (R 3.6.3)
Matrix * 1.2-18 2019-11-27 [4] CRAN (R 3.6.1)
MatrixModels 0.4-1 2015-08-22 [1] CRAN (R 3.6.0)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.0)
mgcv 1.8-31 2019-11-09 [4] CRAN (R 3.6.1)
minqa 1.2.4 2014-10-09 [1] CRAN (R 3.6.0)
modelr 0.1.7 2020-04-30 [1] CRAN (R 3.6.3)
multcomp 1.4-13 2020-04-08 [1] CRAN (R 3.6.3)
munsell 0.5.0 2018-06-12 [1] CRAN (R 3.6.0)
mvtnorm 1.1-0 2020-02-24 [1] CRAN (R 3.6.3)
nlme 3.1-147 2020-04-13 [1] CRAN (R 3.6.3)
nloptr 1.2.2.1 2020-03-11 [1] CRAN (R 3.6.3)
numDeriv 2016.8-1.1 2019-06-06 [1] CRAN (R 3.6.0)
openxlsx 4.1.5 2020-05-06 [1] CRAN (R 3.6.3)
packrat 0.5.0 2018-11-14 [1] CRAN (R 3.6.0)
papaja * 0.1.0.9842 2020-05-13 [1] local
pbapply 1.4-2 2019-08-31 [1] CRAN (R 3.6.1)
pillar 1.4.4 2020-05-05 [1] CRAN (R 3.6.3)
pkgbuild 1.0.8 2020-05-07 [1] CRAN (R 3.6.3)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.1)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.0)
plyr 1.8.6 2020-03-03 [1] CRAN (R 3.6.3)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.3)
processx 3.4.2 2020-02-09 [1] CRAN (R 3.6.3)
ps 1.3.3 2020-05-08 [1] CRAN (R 3.6.3)
purrr * 0.3.4 2020-04-17 [1] CRAN (R 3.6.3)
R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.1)
Rcpp 1.0.4.6 2020-04-09 [1] CRAN (R 3.6.3)
readr * 1.3.1 2018-12-21 [1] CRAN (R 3.6.0)
readxl 1.3.1 2019-03-13 [1] CRAN (R 3.6.0)
remotes 2.1.1 2020-02-15 [1] CRAN (R 3.6.3)
reprex 0.3.0 2019-05-16 [1] CRAN (R 3.6.3)
reshape2 1.4.4 2020-04-09 [1] CRAN (R 3.6.3)
rio 0.5.16 2018-11-26 [1] CRAN (R 3.6.0)
rjags 4-10 2019-11-06 [1] CRAN (R 3.6.1)
rlang 0.4.6.9000 2020-05-12 [1] Github (r-lib/rlang@4bea875)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.0)
rstudioapi 0.11 2020-02-07 [1] CRAN (R 3.6.3)
runjags 2.0.4-6 2019-12-17 [1] CRAN (R 3.6.1)
rvest 0.3.5 2019-11-08 [1] CRAN (R 3.6.1)
sandwich 2.5-1 2019-04-06 [1] CRAN (R 3.6.0)
scales 1.1.1 2020-05-11 [1] CRAN (R 3.6.3)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0)
statmod 1.4.34 2020-02-17 [1] CRAN (R 3.6.3)
stringi 1.4.6 2020-02-17 [1] CRAN (R 3.6.3)
stringr * 1.4.0 2019-02-10 [1] CRAN (R 3.6.0)
survival 3.1-12 2020-04-10 [1] CRAN (R 3.6.3)
testthat 2.3.2 2020-03-02 [1] CRAN (R 3.6.3)
TH.data 1.0-10 2019-01-21 [1] CRAN (R 3.6.0)
tibble * 3.0.1 2020-04-20 [1] CRAN (R 3.6.3)
tidyr * 1.0.3 2020-05-07 [1] CRAN (R 3.6.3)
tidyselect 1.1.0 2020-05-11 [1] CRAN (R 3.6.3)
tidyverse * 1.3.0 2019-11-21 [1] CRAN (R 3.6.3)
TreeBUGS * 1.4.5 2020-05-14 [1] local
usethis 1.6.1 2020-04-29 [1] CRAN (R 3.6.3)
vctrs 0.3.0.9000 2020-05-12 [1] Github (r-lib/vctrs@4ff6b79)
withr 2.2.0 2020-04-20 [1] CRAN (R 3.6.3)
xfun 0.13 2020-04-13 [1] CRAN (R 3.6.3)
xml2 1.3.2 2020-04-23 [1] CRAN (R 3.6.3)
xtable 1.8-4 2019-04-21 [1] CRAN (R 3.6.0)
zip 2.0.4 2019-09-01 [1] CRAN (R 3.6.1)
zoo 1.8-8 2020-05-02 [1] CRAN (R 3.6.3)
[1] /home/mariusbarth/R/x86_64-pc-linux-gnu-library/3.6
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library
I runed an example code like:
EQNfile <- system.file("MPTmodels/2htsm.eqn", package="TreeBUGS")
d.encoding <- subset(arnold2013, group == "encoding", select = -(1:4))
fit <- betaMPT(EQNfile, d.encoding, n.thin=5,
restrictions=list("D1=D2=D3","d1=d2","a=g"))
plot(fit, parameter = "mean", type = "default")
summary(fit)
how ever it gets : could not find function "fitModel"
What causes this?
Hey!
I'm fitting a latent-trait model with 14 parameters and I've stumbled across an issue in plotConvergence.R.
Specifically, when investigating convergence I've noticed that the plots for the 10+th parameter were labelled in a weird way: with the names of two other parameters concatenated (e.g. "C1C2" instead of "S").
Using debug()
, I could trace the issue down to the idx2name()
function in plotConvergence.R.
The simple gsub()
command in the for-loop matches every occurence of [1 including the one's in [10 [11 [12 etc.
Thus the weird double names.
A similar issue could emerge if parameter names are nested: say, you have a parameter "N" and other parameters "Npro", "Npre" etc.
Then, name2idx()
would match every occurence of "N", leading to troubles.
Other issues could probably emerge if parameter names end on numbers, say "C1".
Anyways, I figured it makes sense to match surrounding brackets and commas as well.
I already figured out a solution and tested the functions in isolation. I also tested it within the package, and it apparently fixed the issues. However, I have no experience with package building, so I can't test it thoroughly. I'll open a pull request, so I'd be glad if you could test it!
All the best,
Paul
Hi,
I was trying to use the package for modeling tree which has within-subject factor. As I have gone through the package's paper, you have given example to model between-subject factor. Should I model the 2htsm for each level of within-subject factor (which I think is wrong, but I do not see any other way as I don't understand how to specify that in treeBUGS package)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.