STATS-UOA / s20x

Statistics 20x library
GNU General Public License v2.0
2 stars 6 forks source link

Modification to make backtransformations easier #7

Closed snjnz closed 4 years ago

snjnz commented 4 years ago

Changes to multipleComp, summary2way and estimateConstrasts to accept a function FUN for the purposes of backtransformation, although in most cases the functions can be wrapped with exp() this also transforms p-values which can confound students and usually results in interesting code solutions to work around the issue.

The main goal here is (without breaking existing code/examples - hence defaulting to identity) exposing a method for users/students to backtransform the inner parts of the tukey intervals without having to know matrix sub-setting, or as is more common, getting confused with p-values going erratic.

snjnz commented 4 years ago

Yeah, nice spotting, it should've also backtransformed the means/effects tables (I'd suggest renaming the 'means' table but since we can't always tell what backtransform will be applied, we'll have issues there...

I've changed it to return a results and results.identity object to the list - results.identity as the untransformed data, while results taking the backtransformed data to match what is printed. I'll need to update the docstrings to note the new output format...

snjnz commented 4 years ago

I've just snuck in another fix unrelated to the main set of fixes, basically if page="interaction" but the model doesn't have a 2nd order term, there is a rather unfriendly error as it tries to access part of the out list that doesn't exist. Quick low-risk touch up to throw a stop with a friendlier error.