Git Product home page Git Product logo

edstan's People

Contributors

danielcfurr avatar selbosh avatar sylee30 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

edstan's Issues

Improve mrasch() wrapper.

The stan program should use the Cholesky decomposition, perhaps with a weak prior on the covariance matrix. Also, a better example is needed for the help documentation--the four-item spelling data is not a good example.

Problem with OR in case study Two-Parameter Logistic Item Response Model tackeled

Dear readers,
I just worked through your case study "Two-Parameter Logistic Item Response Model" (https://mc-stan.org/users/documentation/case-studies/tutorial_twopl.html) and ran into an issue adapting your odds ratio function. I had some compares where some of the pairs counted to zero and table() gave back a frequency table smaller that 2x2. It ttok my some hours of work to come up with this (probably not optimized) code snipped (see below).

Maybe you know a better way to handle this issue but i think it might be handy for future readers of your case study to bypass this error faster.

Sincerelly Simon

  n <- nrow(X)
  p <- ncol(X)
  ind <- t(combn(p, 2))
  nind <- nrow(ind)
  OR <- numeric(nind)
  for (i in 1:nind) {
    # print(i)
    xtab <- my.freq.table(X[, ind[i, 1]], X[, ind[i, 2]]) 
    n00 <- xtab[1, 1]
    n01 <- xtab[1, 2]
    n10 <- xtab[2, 1]
    n11 <- xtab[2, 2]
    OR[i] <- (n00 * n11)/(n01 * n10)
  }
  pw.OR <- data.frame(ind, OR)
  names(pw.OR) <- c("item_i", "item_j", "OR")
  
  return(pw.OR)
}

my.freq.table <- function(x,y) {
  xtab <- table(x,y)
  
# handles frequency tables with lower rank
  if((nrow(xtab) != ncol(xtab)) | (nrow(xtab) == 1 & nrow(xtab) == 1)) {
    xtab <- table(x,y) %>% as.data.frame() %>% defactor()
    dat <- data.frame(c(0,0,0),
                      c(1,0,0),
                      c(0,1,0),
                      c(1,1,0)) %>% t() %>% data.frame() %>% setNames(c('x','y','Freq'))
    rownames(dat) <- NULL
    
    dat <- dat %>% mutate(Freq = ifelse(x == xtab$x & y == xtab$y, xtab$Freq, Freq))
    
    xtab <- xtabs(Freq ~ x+y, data = dat)
  } 
  
  return(xtab)
}

# I don't can handle factors well yet so I just pull the numbers out
defactor <- function(d) {
  dat <- data.frame(matrix(NA, nrow = nrow(d), ncol = ncol(d))) %>% setNames(colnames(d))
  
  for (i in 1:nrow(d)) {
    for (j in 1:ncol(d)) {
      if (is.factor(d[i,j])) {dat[i,j] <- as.numeric(levels(d[i,j]))[d[i,j]]}
      else {dat[i,j] <- d[i,j]}
    }
  }
  
  return(dat)
}

Clean up output from $results()

The output for the 2PL results() method is using odd choices for number of decimal places. Also, n_eff should be rounded to whole numbers and rhat should be set to 1 if < 1.

Latent regression 2PL

Either (1) integrate the latent reg code into edstan by generalizing it to multiple person covariates and then writing a wrapper for it, or (2) store the code outside of edstan.

Does edstan provide any plotting options?

First of all, thank you very much for great package ! Incredibly useful. I was wondering if there are any functions to generate trace plots or information plots for item sets (such as the ones provided in other packages like mirt). I understand with edstan we would have entire posterior distributions for parameters instead of point estimates. Can you provide some hints or divert me to any existing resources that would make such plots from edstan fits easier? Thanks a lot.

Verify methods $best_logLik() and $DIC()

Methods $best_logLik() and $DIC() both rely on getting likelihood for given parameter values. Verify that the method used to do this is correct. Some built in rstan functions may provide this functionality, but are not well-documented. May have to check with Columbia team.

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.