Coder Social home page Coder Social logo

dstarm's People

Contributors

vandenman avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dstarm's Issues

mismatch between data and response levels causes problems with labeling in plotObserved

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.

Only up to 2 condition terms can be specified

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.