vandenman / dstarm Goto Github PK
View Code? Open in Web Editor NEWR package DstarM
R package DstarM
Thanks for the package. I found a minor bug.
If the first response that appears in the dataframe used to fit a model is the second level of the response factor, then the labels in the qqplots produced by plotObserved are wrong. The same happens if the first condition that appears in the dataframe is not condition 1.
I could circumvent this issue by sorting the data beforehand (e.g. dat <- dat[order(dat$response, dat$condition), ]).
Here is some code that reproduces the issue.
# data simulation
tt = seq(0, 5, .1)
pars = c(.8, 2, .5, .5, .5, # condition 1
.8, 3, .5, .5, .5) # condition 2
pdfND = dbeta(tt, 10, 30)
lst = simData(n = 3e3, pars = pars, tt = tt, pdfND = pdfND, return.pdf = TRUE)
dat = lst$dat
# define restriction matrix
restr = matrix(1:5, 5, 2)
restr[2, 1:2] = 6:7 # allow drift rates to differ
# fix variance parameters
fixed = matrix(c('sz1', .5, 'sv1', .5), 2, 2)
#fit model
resD = estDstarM(dat = dat, tt = tt, restr = restr, fixed = fixed)
resND = estND(resD)
#estimate observed
resObs = estObserved(resD, resND)
# If the dataframe is properly sorted, no issue.
plotObserved(resObserved = resObs, data = dat,
xlim = c(0, 1))
with(dat, table(condition, response))
#lower.1 = 267. OK!
#Not a problem there
#Flip data frame and re-run the analysis
dat = dat[nrow(dat):1, ]
head(dat)
resD = estDstarM(dat = dat, tt = tt, restr = restr, fixed = fixed)
resND = estND(resD)
resObs = estObserved(resD, resND)
#If the dataframe is not properly sorted, the issue arises
plotObserved(resObserved = resObs, data = dat,
xlim = c(0, 1))
with(dat, table(condition, response))
#lower.1 = 1355. Not OK!
#Labels are switched.
When I run the following code,
fit2<-estDstarM(formula = is_pull ~ decisiongrab + is_target * is_spidertask,
data=ds, tt=(0:100)/100, verbose = T)
I get this error:
Error in getData(formula, data, verbose = verbose) :
More than 3 columns remained after specifying model.frame(formula, data = data)
I had a look in the getData() function and it seems to simply check the number of terms on the right-hand side, and error if there are more than 3 of them (incl the reaction time term). However, this is inconsistent with the help file: there, it is suggested that you can specify as many conditions as you want.
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.