Using d3 library for calculating quantile

URL of experiment:

Description of the problem: I need to calculate a quantile of RTs in a block so I can adjust a feedback threshold and it looks like the most direct way to do this is with d3.quantile(). I downloaded d3 and put the folder in resources following this post (How to use my own modules on pavlovia). But I’m getting an error that ’ * ReferenceError: d3 is not defined’.

I using d3 here numRpt_thresh = d3.quantile(numRpt_accum, 0.33); and numRpt_accum is an array that gets appended on each trial of the preceding block as follows lettSwt_accum.append(target_resp.rt);

Is there an alternative way to import d3 or to calculate a quantile using the currently available js libraries?


Dear @Joseph_Orr, would it be possible to give me access to your repo so that I can have a closer look? Here to help, thanks, s.

Thanks! The code is here and it should be public.

Got it, thanks, x

Hey @Joseph_Orr, I was able to load d3 from cdnjs by adding an index.html script tag, which makes it globally available like you describe. Hope that suits your needs. Please let me know if you need more help, s.

Great, thanks! I appreciate it.