| cmd_onevar | Function (ROM Call 0x368)

AMS 1.01 or higher | bascmd.h

void cmd_onevar (ESI StatData);

Executes TI-Basic 'OneVar' command.

cmd_onevar calculates one-variable statistics and updates all statistics variables (see TI-Basic manual for more info). The StatData parameter must point to a structure on the expression stack which describes where the actual data is stored. This structure may have one of the following four layouts (StatData should point to the last item):

NOTHING_TAG NOTHING_TAG NOTHING_TAG list_name
NOTHING_TAG NOTHING_TAG freqs_name list_name
END_TAG categories_list LIST_TAG categories_name NOTHING_TAG list_name
END_TAG categories_list LIST_TAG categories_name freqs_name list_name

list_name is the VAT symbol name (see SYMSTR and Tags for more info) of a TI-Basic list variable which contains the values. freqs_name (if present) is the VAT symbol name of a TI-Basic list variable which contains the frequencies (all frequencies are assumed to be 1 if freqs_name is not present). categories_name (if present) is the VAT symbol name of a TI-Basic list which contains the category code for each item. categories_list represents a list of integer items which determine which categories will be included (this makes sense only when categories_name is used).
For example, assuming that the TI-Basic list variable "dataval" contains statistical data, you can calculate simple one-variable statistics using the following code fragment:

    push_quantum (NOTHING_TAG);
    push_quantum (NOTHING_TAG);
    push_quantum (NOTHING_TAG);
    push_expression (SYMSTR ("datavals"));
    cmd_onevar (top_estack);

After this, you can retrieve the calculated regression data by accessing TI-Basic system variables like "minX" directly (using VarRecall, for example), or you can display the calculated data using cmd_showstat.
The symbol names list_name, freqs_name, and categories_name may also be "c1".."c99". In this case, they represent columns in the last data variable shown in the Data/Matrix editor. In all cases, the lists represented by list_name, freqs_name, and categories_name must have the same dimension.

Uses: HeapAlloc, HeapDeref, HeapFree, HeapFreeIndir, HeapRealloc, HLock, ER_catch, ER_success, ER_throwVar, estack_to_ushort, next_expression_index, ST_helpMsg, XR_stringPtr, ceil, fabs, floor, sqrt, ck_valid_float, estack_to_float, is_cFloat_agg, OO_GetAppAttr, PlotInit, PlotPut, RM_Type, statFree, statStart, MakeWinRect, WinFill, WinFillTriangle, WinLine, WinRect, WinStrXY, _bcd_math, ROM Call 0x46B, ROM Call 0x4CB

See also: cmd_twovar, cmd_linreg, cmd_quadreg, cmd_cubicreg, cmd_quartreg, cmd_powerreg, cmd_expreg, cmd_lnreg, cmd_sinreg, cmd_medmed, cmd_logistic