qstudentt function in FlexSim is supposed to return a two-tailed inverse of the Student's t-distribution.
It came to my attention, that only three hard-coded quantiles are properly supported (0.9, 0.95, 0.99). For other levels the function proceeds without an error and silently returns wrong numeric values:
Please note that the values for levels 0.98, 0.99 and 0.999 are all the same in FlexSim (2.819 for dof=22). All values are also rounded to only 3 digits after the dot.
Both R and Excel do a better job of calculating an inverse of the t-distribution. For reference, the same values calculated in R:
> conf.levels <- c(0.95, 0.98, 0.99, 0.999, 0.9999) > q.upper <- 1 - 0.5*(1 - conf.levels) > q.upper [1] 0.97500 0.99000 0.99500 0.99950 0.99995 > qt(q.upper, df = 22, lower.tail = TRUE) [1] 2.073873 2.508325 2.818756 3.792131 4.736124
t-test is probably the most popular hypothesis testing tool. qstudentt is the only built-in FlexSim function to implement the t-test. Wrong values qstudentt() prevent users from estimating the probability associated with the test. This may also lead to wrong decisions.
Proposal:
- fix qstudentt() and allow arbitrary quantiles as the first parameter
- implement a ttest() function similar to the one found in Excel, R and other statistics packages (two data sets in, one probability out)
- implement one-sided and paired tests too
As for the implementation of the t-test function, which should take two data sets as parameters, it would be nice if it were properly integrated with FlexSim, and accepted anything that qualifies as a data sequence in FlexSim: Arrays, table columns/rows (as well as Experimenter data), and just subtrees with numeric data on the leaf nodes.
Edit: Another issue with qstudentt: it doesn't support fractional values of the degrees of freedom parameter. They're required to implement Welch's t-test.