andytimm / retrodesign

Tools for working with Type S (sign) and Type M (magnitude) errors in R
Other
5 stars 2 forks source link

Ensure all variants of function work as expected with vector input #4

Closed andytimm closed 1 year ago

andytimm commented 1 year ago

Another one from @martijnweterings here;

In retrodesign, it's possible to get incorrect results when passing a vector input.

This isn't an issue in the paper reproduction materials (Andrew understood this limitation of the function as written, and all reproduction code works), but it's worth closing off the possibility of this error for more general use in the package, since many R users will think of a vector input before iterating with scalar inputs or passing a list.

This applies to retrodesign, but also the closed form implementation.

Finishing this issue should involve re-writing all functions to handle vectors inputs, and adding test coverage.

Reprex of this breaking:

retrodesign::retrodesign(c(10,rep(0.1,100)), 1, alpha = 0.05, df = Inf, n.sims = 10^5)$exaggeration[1]

retrodesign::retrodesign(c(10), 1, alpha = 0.05, df = Inf, n.sims = 10^5)$exaggeration