dicook / nullabor

Tools for doing statistical inference using data plots
http://dicook.github.io/nullabor/
56 stars 10 forks source link

visual_power hard coded for m = 20 #16

Closed emitanaka closed 5 days ago

emitanaka commented 4 years ago

The power calculation looks like it is hardcoded for when the lineup size is 20? The 19 below should be m-1 I think?

visual_power <- function(data, m=20) {
  pic_id <- NULL
  detected <- NULL
  nchoices_wgt <- NULL

  data <- data %>% mutate(
    nchoices_wgt = (m-lengths(strsplit(as.character(data$response), ",")))/19) #<<
  visual_p <- data %>% group_by(pic_id) %>%
    summarise(power = sum(detected*nchoices_wgt)/length(detected), n=length(detected))
  return(visual_p)
}
heike commented 4 years ago

I agree. To clean it up a bit more, it might be good, to also parameterize the number of targets instead of just assuming 1.

On Sun, Oct 25, 2020 at 6:31 AM Emi Tanaka notifications@github.com wrote:

The power calculation looks like it is hardcoded for when the lineup size is 20? The 19 below should be m-1 I think?

visual_power <- function(data, m=20) { pic_id <- NULL detected <- NULL nchoices_wgt <- NULL

data <- data %>% mutate( nchoices_wgt = (m-lengths(strsplit(as.character(data$response), ",")))/19) #<< visual_p <- data %>% group_by(pic_id) %>% summarise(power = sum(detected*nchoices_wgt)/length(detected), n=length(detected)) return(visual_p) }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dicook/nullabor/issues/16, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAWVUWD5PAV2WUMXAPVV7TSMQD77ANCNFSM4S6IRSIQ .

dicook commented 4 years ago

The simple fix is done. Thanks @emitanaka

dicook commented 4 years ago

@heike do you have the formula for multiple targets? This code is very specifically geared to the early experiments, assuming the data structure contains pic_id, detected, mchoices_wgt, too. I'd forgotten that I added this function - I put it in because how to make the calculation was a bit hidden in the published papers. It could be better written generally.