User-defined Function
Menu location: Data_Transforming and Deriving_User-defined Function.
This applies an algebraic expression to any selection of data. The workbook column(s) you select are given the variable names X1, X2 ... Xn in the order that they are selected from left to right across the workbook. You can then create a new column as a function of those selected. You do this by entering an algebraic expression that can use any of the functions, operators and constants below. For example X1/SQR(X2) would produce a column where each row entry was that of the first selected column divided by the square root of the corresponding row entry in the second selected column.
The same results can be achieved using intrinsic functions within a StatsDirect workbook. Large complex functions may be handled faster by the intrinsic workbook functions of StatsDirect.
Constants | |
PI | 3.14159265358979323846 (p) |
EE | 2.71828182845904523536 (e) |
Arithmetic Functions | |
ABS | absolute value |
CLOG | common (base 10) logarithm |
CEXP | anti log (base 10) |
EXP | anti log (base e) |
LOG | natural (base e, Naperian) logarithm |
LOGIT | logit: log(p/[1-p]), p=proportion |
ALOGIT | antilogit: exp(l)/[1+exp(l)], l=logit |
SQR or SQRT | square root |
! | factorial (maximum 170.569) |
LOG! | log factorial |
IZ | normal deviate for a p value |
UZ | upper tail p for a normal deviate |
LZ | lower tail p for a normal deviate |
TRUNC or FIX | integer part of a real number |
CINT | real number rounded to nearest integer |
INT | real number truncated to integer closest to zero |
Please note that the largest factorial allowed is 170.569398315538748, but you can work with Log factorials via the LOG! function, e.g. LOG!(171).
Arithmetic Operators | |
^ | exponentiation (to the power of) |
+ | addition |
- | subtraction |
* | multiplication |
/ | division |
\ | integer division |
Calculations give an order of priority to arithmetic operators; this must be considered when entering expressions. For example, the result of the expression "6 - 3/2" is 4.5 and not 1.5 because division takes priority over subtraction.
Priority of arithmetic operators in descending order
- Exponentiation (^ or **)
- Negation (-X) (Exception = x^-y; i.e. 4^-2 is 0.0625 and not -16)
- Multiplication and Division (*, /)
- Integer Division (\)
- Addition and Subtraction (+, -)
Trigonometric Functions | |
ARCCOS | arc cosine |
ARCCOSH | arc hyperbolic cosine |
ARCCOT | arc cotangent |
ARCCOTH | arc hyperbolic cotangent |
ARCCSC | arc cosecant |
ARCCSCH | arc hyperbolic cosecant |
ARCTANH | arc hyperbolic tangent |
ARCSEC | arc secant |
ARCSECH | arc hyperbolic secant |
ARCSIN | arc sine |
ARCSINH | arc hyperbolic sine |
ATN | arc tangent |
COS | cosine |
COT | cotangent |
COTH | hyperbolic cotangent |
CSC | cosecant |
CSCH | hyperbolic cosecant |
SIN | sine |
SINH | hyperbolic sine |
SECH | hyperbolic secant |
SEC | secant |
TAN | tangent |
TANH | hyperbolic tangent |
To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.
Logical Functions | |
AND | logical AND |
NOT | logical NOT |
OR | logical OR |
< | less than |
= | equal to |
> | greater than |
<> (also ><) | not equal to |
>= (also =>) | greater than or equal to |
<= (also =<) | less than or equal to |
true | expression outcome is true |
false | expression outcome is false |