1 @node Expressions, Data Input and Output, Language, Top
2 @chapter Mathematical Expressions
3 @cindex expressions, mathematical
4 @cindex mathematical expressions
6 Expressions share a common syntax each place they appear in PSPP
7 commands. Expressions are made up of @dfn{operands}, which can be
8 numbers, strings, or variable names, separated by @dfn{operators}.
9 There are five types of operators: grouping, arithmetic, logical,
10 relational, and functions.
12 Every operator takes one or more operands as input and yields exactly
13 one result as output. Depending on the operator, operands accept
14 strings or numbers as operands. With few exceptions, operands may be
15 full-fledged expressions in themselves.
18 * Boolean Values:: Boolean values.
19 * Missing Values in Expressions:: Using missing values in expressions.
20 * Grouping Operators:: parentheses
21 * Arithmetic Operators:: add sub mul div pow
22 * Logical Operators:: AND NOT OR
23 * Relational Operators:: EQ GE GT LE LT NE
24 * Functions:: More-sophisticated operators.
25 * Order of Operations:: Operator precedence.
29 @section Boolean Values
31 @cindex values, Boolean
33 Some PSPP operators and expressions work with Boolean values, which
34 represent true/false conditions. Booleans have only three possible
35 values: 0 (false), 1 (true), and system-missing (unknown).
36 System-missing is neither true nor false and indicates that the true
39 Boolean-typed operands or function arguments must take on one of these
40 three values. Other values are considered false, but provoke a warning
41 when the expression is evaluated.
43 Strings and Booleans are not compatible, and neither may be used in
46 @node Missing Values in Expressions
47 @section Missing Values in Expressions
49 Most numeric operators yield system-missing when given any
50 system-missing operand. A string operator given any system-missing
51 operand typically results in the empty string. Exceptions are listed
52 under particular operator descriptions.
54 String user-missing values are not treated specially in expressions.
56 User-missing values for numeric variables are always transformed into
57 the system-missing value, except inside the arguments to the
58 @code{VALUE} and @code{SYSMIS} functions.
60 The missing-value functions can be used to precisely control how missing
61 values are treated in expressions. @xref{Missing Value Functions}, for
64 @node Grouping Operators
65 @section Grouping Operators
68 @cindex grouping operators
69 @cindex operators, grouping
71 Parentheses (@samp{()}) are the grouping operators. Surround an
72 expression with parentheses to force early evaluation.
74 Parentheses also surround the arguments to functions, but in that
75 situation they act as punctuators, not as operators.
77 @node Arithmetic Operators
78 @section Arithmetic Operators
79 @cindex operators, arithmetic
80 @cindex arithmetic operators
82 The arithmetic operators take numeric operands and produce numeric
88 @item @var{a} + @var{b}
89 Yields the sum of @var{a} and @var{b}.
93 @item @var{a} - @var{b}
94 Subtracts @var{b} from @var{a} and yields the difference.
97 @cindex multiplication
98 @item @var{a} * @var{b}
99 Yields the product of @var{a} and @var{b}. If either @var{a} or
100 @var{b} is 0, then the result is 0, even if the other operand is
105 @item @var{a} / @var{b}
106 Divides @var{a} by @var{b} and yields the quotient. If @var{a} is 0,
107 then the result is 0, even if @var{b} is missing. If @var{b} is zero,
108 the result is system-missing.
111 @cindex exponentiation
112 @item @var{a} ** @var{b}
113 Yields the result of raising @var{a} to the power @var{b}. If
114 @var{a} is negative and @var{b} is not an integer, the result is
115 system-missing. The result of @code{0**0} is system-missing as well.
120 Reverses the sign of @var{a}.
123 @node Logical Operators
124 @section Logical Operators
125 @cindex logical operators
126 @cindex operators, logical
131 @cindex values, system-missing
132 @cindex system-missing
133 The logical operators take logical operands and produce logical
134 results, meaning ``true or false.'' Logical operators are
135 not true Boolean operators because they may also result in a
136 system-missing value. @xref{Boolean Values}, for more information.
141 @cindex intersection, logical
142 @cindex logical intersection
143 @item @var{a} AND @var{b}
144 @itemx @var{a} & @var{b}
145 True if both @var{a} and @var{b} are true, false otherwise. If one
146 operand is false, the result is false even if the other is missing. If
147 both operands are missing, the result is missing.
151 @cindex union, logical
152 @cindex logical union
153 @item @var{a} OR @var{b}
154 @itemx @var{a} | @var{b}
155 True if at least one of @var{a} and @var{b} is true. If one operand is
156 true, the result is true even if the other operand is missing. If both
157 operands are missing, the result is missing.
161 @cindex inversion, logical
162 @cindex logical inversion
165 True if @var{a} is false. If the operand is missing, then the result
169 @node Relational Operators
170 @section Relational Operators
172 The relational operators take numeric or string operands and produce Boolean
175 Strings cannot be compared to numbers. When strings of different
176 lengths are compared, the shorter string is right-padded with spaces
177 to match the length of the longer string.
179 The results of string comparisons, other than tests for equality or
180 inequality, depend on the character set in use. String comparisons
184 @cindex equality, testing
185 @cindex testing for equality
188 @item @var{a} EQ @var{b}
189 @itemx @var{a} = @var{b}
190 True if @var{a} is equal to @var{b}.
192 @cindex less than or equal to
195 @item @var{a} LE @var{b}
196 @itemx @var{a} <= @var{b}
197 True if @var{a} is less than or equal to @var{b}.
202 @item @var{a} LT @var{b}
203 @itemx @var{a} < @var{b}
204 True if @var{a} is less than @var{b}.
206 @cindex greater than or equal to
209 @item @var{a} GE @var{b}
210 @itemx @var{a} >= @var{b}
211 True if @var{a} is greater than or equal to @var{b}.
216 @item @var{a} GT @var{b}
217 @itemx @var{a} > @var{b}
218 True if @var{a} is greater than @var{b}.
220 @cindex inequality, testing
221 @cindex testing for inequality
225 @item @var{a} NE @var{b}
226 @itemx @var{a} ~= @var{b}
227 @itemx @var{a} <> @var{b}
228 True if @var{a} is not equal to @var{b}.
240 @cindex names, of functions
241 PSPP functions provide mathematical abilities above and beyond
242 those possible using simple operators. Functions have a common
243 syntax: each is composed of a function name followed by a left
244 parenthesis, one or more arguments, and a right parenthesis.
246 Function names are not reserved. Their names are specially treated
247 only when followed by a left parenthesis, so that @code{EXP(10)}
248 refers to the constant value @code{e} raised to the 10th power, but
249 @code{EXP} by itself refers to the value of variable EXP.
251 The sections below describe each function in detail.
254 * Mathematics:: EXP LG10 LN LNGAMMA SQRT
255 * Miscellaneous Mathematics:: ABS MOD MOD10 RND TRUNC
256 * Trigonometry:: ACOS ARCOS ARSIN ARTAN ASIN ATAN COS SIN TAN
257 * Missing Value Functions:: MISSING NMISS NVALID SYSMIS VALUE
258 * Set Membership:: ANY RANGE
259 * Statistical Functions:: CFVAR MAX MEAN MIN SD SUM VARIANCE
260 * String Functions:: CONCAT INDEX LENGTH LOWER LPAD LTRIM NUMBER
261 RINDEX RPAD RTRIM STRING SUBSTR UPCASE
262 * Time & Date:: CTIME.xxx DATE.xxx TIME.xxx XDATE.xxx
263 * Miscellaneous Functions:: LAG YRMODA
264 * Statistical Distribution Functions:: PDF CDF SIG IDF RV NPDF NCDF
268 @subsection Mathematical Functions
269 @cindex mathematics, advanced
271 Advanced mathematical functions take numeric arguments and produce
274 @deftypefn {Function} {} EXP (@var{exponent})
275 Returns @i{e} (approximately 2.71828) raised to power @var{exponent}.
279 @deftypefn {Function} {} LG10 (@var{number})
280 Takes the base-10 logarithm of @var{number}. If @var{number} is
281 not positive, the result is system-missing.
284 @deftypefn {Function} {} LN (@var{number})
285 Takes the base-@i{e} logarithm of @var{number}. If @var{number} is
286 not positive, the result is system-missing.
289 @deftypefn {Function} {} LNGAMMA (@var{number})
290 Yields the base-@i{e} logarithm of the complete gamma of @var{number}.
291 If @var{number} is a negative integer, the result is system-missing.
295 @deftypefn {Function} {} SQRT (@var{number})
296 Takes the square root of @var{number}. If @var{number} is negative,
297 the result is system-missing.
300 @node Miscellaneous Mathematics
301 @subsection Miscellaneous Mathematical Functions
302 @cindex mathematics, miscellaneous
304 Miscellaneous mathematical functions take numeric arguments and produce
307 @cindex absolute value
308 @deftypefn {Function} {} ABS (@var{number})
309 Results in the absolute value of @var{number}.
313 @deftypefn {Function} {} MOD (@var{numerator}, @var{denominator})
314 Returns the remainder (modulus) of @var{numerator} divided by
315 @var{denominator}. If @var{numerator} is 0, then the result is 0,
316 even if @var{denominator} is missing. If @var{denominator} is 0, the
317 result is system-missing.
320 @cindex modulus, by 10
321 @deftypefn {Function} {} MOD10 (@var{number})
322 Returns the remainder when @var{number} is divided by 10. If
323 @var{number} is negative, MOD10(@var{number}) is negative or zero.
327 @deftypefn {Function} {} RND (@var{number})
328 Takes the absolute value of @var{number} and rounds it to an integer.
329 Then, if @var{number} was negative originally, negates the result.
333 @deftypefn {Function} {} TRUNC (@var{number})
334 Discards the fractional part of @var{number}; that is, rounds
335 @var{number} towards zero.
339 @subsection Trigonometric Functions
342 Trigonometric functions take numeric arguments and produce numeric
346 @cindex inverse cosine
347 @deftypefn {Function} {} ARCOS (@var{number})
348 @deftypefnx {Function} {} ACOS (@var{number})
349 Takes the arccosine, in radians, of @var{number}. Results in
350 system-missing if @var{number} is not between -1 and 1 inclusive.
351 This function is a PSPP extension.
356 @deftypefn {Function} {} ARSIN (@var{number})
357 @deftypefnx {Function} {} ASIN (@var{number})
358 Takes the arcsine, in radians, of @var{number}. Results in
359 system-missing if @var{number} is not between -1 and 1 inclusive.
363 @cindex inverse tangent
364 @deftypefn {Function} {} ARTAN (@var{number})
365 @deftypefnx {Function} {} ATAN (@var{number})
366 Takes the arctangent, in radians, of @var{number}.
370 @deftypefn {Function} {} COS (@var{angle})
371 Takes the cosine of @var{angle} which should be in radians.
375 @deftypefn {Function} {} SIN (@var{angle})
376 Takes the sine of @var{angle} which should be in radians.
380 @deftypefn {Function} {} TAN (@var{angle})
381 Takes the tangent of @var{angle} which should be in radians.
382 Results in system-missing at values
383 of @var{angle} that are too close to odd multiples of pi/2.
387 @node Missing Value Functions
388 @subsection Missing-Value Functions
389 @cindex missing values
390 @cindex values, missing
391 @cindex functions, missing-value
393 Missing-value functions take various numeric arguments and yield
394 various types of results. Except where otherwise stated below, the
395 normal rules of evaluation apply within expression arguments to these
396 functions. In particular, user-missing values for numeric variables
397 are converted to system-missing values.
399 @deftypefn {Function} {} MISSING (@var{expr})
400 Returns 1 if @var{expr} has the system-missing value, 0 otherwise.
403 @deftypefn {Function} {} NMISS (@var{expr} [, @var{expr}]@dots{})
404 Each argument must be a numeric expression. Returns the number of
405 system-missing values in the list, which may include variable ranges
406 using the @code{@var{var1} TO @var{var2}} syntax.
409 @deftypefn {Function} {} NVALID (@var{expr} [, @var{expr}]@dots{})
410 Each argument must be a numeric expression. Returns the number of
411 values in the list that are not system-missing. The list may include
412 variable ranges using the @code{@var{var1} TO @var{var2}} syntax.
415 @deftypefn {Function} {} SYSMIS (@var{expr})
416 When @var{expr} is simply the name of a numeric variable, returns 1 if
417 the variable has the system-missing value, 0 if it is user-missing or
418 not missing. If given @var{expr} takes another form, results in 1 if
419 the value is system-missing, 0 otherwise.
422 @deftypefn {Function} {} VALUE (@var{variable})
423 Prevents the user-missing values of @var{variable} from being
424 transformed into system-missing values, and always results in the
425 actual value of @var{variable}, whether it is valid, user-missing, or
430 @subsection Set-Membership Functions
431 @cindex set membership
432 @cindex membership, of set
434 Set membership functions determine whether a value is a member of a set.
435 They take a set of numeric arguments or a set of string arguments, and
436 produce Boolean results.
438 String comparisons are performed according to the rules given in
439 @ref{Relational Operators}.
441 @deftypefn {Function} {} ANY (@var{value}, @var{set} [, @var{set}]@dots{})
442 Results in true if @var{value} is equal to any of the @var{set}
443 values. Otherwise, results in false. If @var{value} is
444 system-missing, returns system-missing. System-missing values in
445 @var{set} do not cause ANY to return system-missing.
448 @deftypefn {Function} {} RANGE (@var{value}, @var{low}, @var{high} [, @var{low}, @var{high}]@dots{})
449 Results in true if @var{value} is in any of the intervals bounded by
450 @var{low} and @var{high} inclusive. Otherwise, results in false.
451 Each @var{low} must be less than or equal to its corresponding
452 @var{high} value. @var{low} and @var{high} must be given in pairs.
453 If @var{value} is system-missing, returns system-missing.
454 System-missing values in @var{set} do not cause RANGE to return
458 @node Statistical Functions
459 @subsection Statistical Functions
460 @cindex functions, statistical
463 Statistical functions compute descriptive statistics on a list of
464 values. Some statistics can be computed on numeric or string values;
465 other can only be computed on numeric values. Their results have the
466 same type as their arguments. The current case's weighting factor
467 (@pxref{WEIGHT}) has no effect on statistical functions.
469 These functions' argument lists may include entire ranges of variables
470 using the @code{@var{var1} TO @var{var2}} syntax.
472 @cindex arguments, minimum valid
473 @cindex minimum valid number of arguments
474 Unlike most functions, statistical functions can return non-missing
475 values even when some of their arguments are missing. Most
476 statistical functions, by default, require only 1 non-missing value to
477 have a non-missing return, but CFVAR, SD, and VARIANCE require 2.
478 These defaults can be increased (but not decreased) by appending a dot
479 and the minimum number of valid arguments to the function name. For
480 example, @code{MEAN.3(X, Y, Z)} would only return non-missing if all
481 of @samp{X}, @samp{Y}, and @samp{Z} were valid.
483 @cindex coefficient of variation
484 @cindex variation, coefficient of
485 @deftypefn {Function} {} CFVAR (@var{number}, @var{number}[, @dots{}])
486 Results in the coefficient of variation of the values of @var{number}.
487 (The coefficient of variation is the standard deviation divided by the
492 @deftypefn {Function} {} MAX (@var{value}, @var{value}[, @dots{}])
493 Results in the value of the greatest @var{value}. The @var{value}s may
494 be numeric or string.
498 @deftypefn {Function} {} MEAN (@var{number}, @var{number}[, @dots{}])
499 Results in the mean of the values of @var{number}.
503 @deftypefn {Function} {} MIN (@var{number}, @var{number}[, @dots{}])
504 Results in the value of the least @var{value}. The @var{value}s may
505 be numeric or string.
508 @cindex standard deviation
509 @cindex deviation, standard
510 @deftypefn {Function} {} SD (@var{number}, @var{number}[, @dots{}])
511 Results in the standard deviation of the values of @var{number}.
515 @deftypefn {Function} {} SUM (@var{number}, @var{number}[, @dots{}])
516 Results in the sum of the values of @var{number}.
520 @deftypefn {Function} {} VARIANCE (@var{number}, @var{number}[, @dots{}])
521 Results in the variance of the values of @var{number}.
524 @node String Functions
525 @subsection String Functions
526 @cindex functions, string
527 @cindex string functions
529 String functions take various arguments and return various results.
531 @cindex concatenation
532 @cindex strings, concatenation of
533 @deftypefn {Function} {} CONCAT (@var{string}, @var{string}[, @dots{}])
534 Returns a string consisting of each @var{string} in sequence.
535 @code{CONCAT("abc", "def", "ghi")} has a value of @code{"abcdefghi"}.
536 The resultant string is truncated to a maximum of 255 characters.
539 @cindex searching strings
540 @deftypefn {Function} {} INDEX (@var{haystack}, @var{needle})
541 Returns a positive integer indicating the position of the first
542 occurrence of @var{needle} in @var{haystack}. Returns 0 if @var{haystack}
543 does not contain @var{needle}. Returns system-missing if @var{needle}
547 @deftypefn {Function} {} INDEX (@var{haystack}, @var{needles}, @var{needle_len})
548 Divides @var{needles} into one or more needles, each with length
550 Searches @var{haystack} for the first occurrence of each needle, and
551 returns the smallest value. Returns 0 if @var{haystack} does not
552 contain any part in @var{needle}. It is an error if @var{needle_len}
553 does not evenly divide the length of @var{needles}. Returns
554 system-missing if @var{needles} is an empty string.
557 @cindex strings, finding length of
558 @deftypefn {Function} {} LENGTH (@var{string})
559 Returns the number of characters in @var{string}.
562 @cindex strings, case of
563 @deftypefn {Function} {} LOWER (@var{string})
564 Returns a string identical to @var{string} except that all uppercase
565 letters are changed to lowercase letters. The definitions of
566 ``uppercase'' and ``lowercase'' are system-dependent.
569 @cindex strings, padding
570 @deftypefn {Function} {} LPAD (@var{string}, @var{length})
571 If @var{string} is at least @var{length} characters in length, returns
572 @var{string} unchanged. Otherwise, returns @var{string} padded with
573 spaces on the left side to length @var{length}. Returns an empty string
574 if @var{length} is system-missing, negative, or greater than 255.
577 @deftypefn {Function} {} LPAD (@var{string}, @var{length}, @var{padding})
578 If @var{string} is at least @var{length} characters in length, returns
579 @var{string} unchanged. Otherwise, returns @var{string} padded with
580 @var{padding} on the left side to length @var{length}. Returns an empty
581 string if @var{length} is system-missing, negative, or greater than 255, or
582 if @var{padding} does not contain exactly one character.
585 @cindex strings, trimming
586 @cindex white space, trimming
587 @deftypefn {Function} {} LTRIM (@var{string})
588 Returns @var{string}, after removing leading spaces. Other white space,
589 such as tabs, carriage returns, line feeds, and vertical tabs, is not
593 @deftypefn {Function} {} LTRIM (@var{string}, @var{padding})
594 Returns @var{string}, after removing leading @var{padding} characters.
595 If @var{padding} does not contain exactly one character, returns an
599 @cindex numbers, converting from strings
600 @cindex strings, converting to numbers
601 @deftypefn {Function} {} NUMBER (@var{string}, @var{format})
602 Returns the number produced when @var{string} is interpreted according
603 to format specifier @var{format}. If the format width @var{w} is less
604 than the length of @var{string}, then only the first @var{w}
605 characters in @var{string} are used, e.g.@: @code{NUMBER("123", F3.0)}
606 and @code{NUMBER("1234", F3.0)} both have value 123. If @var{w} is
607 greater than @var{string}'s length, then it is treated as if it were
608 right-padded with spaces. If @var{string} is not in the correct
609 format for @var{format}, system-missing is returned.
612 @cindex strings, searching backwards
613 @deftypefn {Function} {} RINDEX (@var{string}, @var{format})
614 Returns a positive integer indicating the position of the last
615 occurrence of @var{needle} in @var{haystack}. Returns 0 if
616 @var{haystack} does not contain @var{needle}. Returns system-missing if
617 @var{needle} is an empty string.
620 @deftypefn {Function} {} RINDEX (@var{haystack}, @var{needle}, @var{needle_len})
621 Divides @var{needle} into parts, each with length @var{needle_len}.
622 Searches @var{haystack} for the last occurrence of each part, and
623 returns the largest value. Returns 0 if @var{haystack} does not contain
624 any part in @var{needle}. It is an error if @var{needle_len} does not
625 evenly divide the length of @var{needle}. Returns system-missing
626 if @var{needle} is an empty string.
629 @cindex padding strings
630 @cindex strings, padding
631 @deftypefn {Function} {} RPAD (@var{string}, @var{length})
632 If @var{string} is at least @var{length} characters in length, returns
633 @var{string} unchanged. Otherwise, returns @var{string} padded with
634 spaces on the right to length @var{length}. Returns an empty string if
635 @var{length} is system-missing, negative, or greater than 255.
638 @deftypefn {Function} {} RPAD (@var{string}, @var{length}, @var{padding})
639 If @var{string} is at least @var{length} characters in length, returns
640 @var{string} unchanged. Otherwise, returns @var{string} padded with
641 @var{padding} on the right to length @var{length}. Returns an empty
642 string if @var{length} is system-missing, negative, or greater than 255,
643 or if @var{padding} does not contain exactly one character.
646 @cindex strings, trimming
647 @cindex white space, trimming
648 @deftypefn {Function} {} RTRIM (@var{string})
649 Returns @var{string}, after removing trailing spaces. Other types of
650 white space are not removed.
653 @deftypefn {Function} {} RTRIM (@var{string}, @var{padding})
654 Returns @var{string}, after removing trailing @var{padding} characters.
655 If @var{padding} does not contain exactly one character, returns an
659 @cindex strings, converting from numbers
660 @cindex numbers, converting to strings
661 @deftypefn {Function} {} STRING (@var{number}, @var{format})
662 Returns a string corresponding to @var{number} in the format given by
663 format specifier @var{format}. For example, @code{STRING(123.56, F5.1)}
664 has the value @code{"123.6"}.
668 @cindex strings, taking substrings of
669 @deftypefn {Function} {} SUBSTR (@var{string}, @var{start})
670 Returns a string consisting of the value of @var{string} from position
671 @var{start} onward. Returns an empty string if @var{start} is system-missing,
672 less than 1, or greater than the length of @var{string}.
675 @deftypefn {Function} {} SUBSTR (@var{string}, @var{start}, @var{count})
676 Returns a string consisting of the first @var{count} characters from
677 @var{string} beginning at position @var{start}. Returns an empty string
678 if @var{start} or @var{count} is system-missing, if @var{start} is less
679 than 1 or greater than the number of characters in @var{string}, or if
680 @var{count} is less than 1. Returns a string shorter than @var{count}
681 characters if @var{start} + @var{count} - 1 is greater than the number
682 of characters in @var{string}. Examples: @code{SUBSTR("abcdefg", 3, 2)}
683 has value @code{"cd"}; @code{SUBSTR("nonsense", 4, 10)} has the value
687 @cindex case conversion
688 @cindex strings, case of
689 @deftypefn {Function} {} UPCASE (@var{string})
690 Returns @var{string}, changing lowercase letters to uppercase letters.
694 @subsection Time & Date Functions
695 @cindex functions, time & date
700 For compatibility, PSPP considers dates before 15 Oct 1582 invalid.
701 Most time and date functions will not accept earlier dates.
704 * Time & Date Concepts:: How times & dates are defined and represented
705 * Time Construction:: TIME.@{DAYS HMS@}
706 * Time Extraction:: CTIME.@{DAYS HOURS MINUTES SECONDS@}
707 * Date Construction:: DATE.@{DMY MDY MOYR QYR WKYR YRDAY@}
708 * Date Extraction:: XDATE.@{DATE HOUR JDAY MDAY MINUTE MONTH
709 QUARTER SECOND TDAY TIME WEEK
713 @node Time & Date Concepts
714 @subsubsection How times & dates are defined and represented
716 @cindex time, concepts
717 @cindex time, intervals
718 Times and dates are handled by PSPP as single numbers. A
719 @dfn{time} is an interval. PSPP measures times in seconds.
720 Thus, the following intervals correspond with the numeric values given:
725 1 day, 3 hours, 10 seconds 97,210
729 @cindex dates, concepts
730 @cindex time, instants of
731 A @dfn{date}, on the other hand, is a particular instant in the past
732 or the future. PSPP represents a date as a number of seconds since
733 midnight preceding 14 Oct 1582. Because midnight preceding the dates
734 given below correspond with the numeric PSPP dates given:
738 4 Jul 1776 6,113,318,400
739 1 Jan 1900 10,010,390,400
740 1 Oct 1978 12,495,427,200
741 24 Aug 1995 13,028,601,600
744 @cindex time, mathematical properties of
745 @cindex mathematics, applied to times & dates
746 @cindex dates, mathematical properties of
748 Ordinary arithmetic operations on dates and times often produce
749 sensible results. Adding a time to, or subtracting one from, a date
750 produces a new date that much earlier or later. The difference of two
751 dates yields the time between those dates. Adding two times produces
752 the combined time. Multiplying a time by a scalar produces a time
753 that many times longer. Since times and dates are just numbers, the
754 ordinary addition and subtraction operators are employed for these
757 Adding two dates does not produce a useful result.
759 As the table shows, dates and times may have very large values. Thus,
760 it is not a good idea to take powers of these values; also, the
761 accuracy of some procedures may be affected. If necessary, convert
762 times or dates in seconds to some other unit, like days or years,
763 before performing analysis.
765 @node Time Construction
766 @subsubsection Functions that Produce Times
767 @cindex times, constructing
768 @cindex constructing times
770 These functions take numeric arguments and return numeric values that
774 @cindex time, in days
775 @deftypefn {Function} {} TIME.DAYS (@var{ndays})
776 Returns a time corresponding to @var{ndays} days.
779 @cindex hours-minutes-seconds
780 @cindex time, in hours-minutes-seconds
781 @deftypefn {Function} {} TIME.HMS (@var{nhours}, @var{nmins}, @var{nsecs})
782 Returns a time corresponding to @var{nhours} hours, @var{nmins}
783 minutes, and @var{nsecs} seconds. The arguments may not have mixed
784 signs: if any of them are positive, then none may be negative, and
788 @node Time Extraction
789 @subsubsection Functions that Examine Times
790 @cindex extraction, of time
791 @cindex time examination
792 @cindex examination, of times
793 @cindex time, lengths of
795 These functions take numeric arguments in PSPP time format and
796 give numeric results.
799 @cindex time, in days
800 @deftypefn {Function} {} CTIME.DAYS (@var{time})
801 Results in the number of days and fractional days in @var{time}.
805 @cindex time, in hours
806 @deftypefn {Function} {} CTIME.HOURS (@var{time})
807 Results in the number of hours and fractional hours in @var{time}.
811 @cindex time, in minutes
812 @deftypefn {Function} {} CTIME.MINUTES (@var{time})
813 Results in the number of minutes and fractional minutes in @var{time}.
817 @cindex time, in seconds
818 @deftypefn {Function} {} CTIME.SECONDS (@var{time})
819 Results in the number of seconds and fractional seconds in @var{time}.
820 (@code{CTIME.SECONDS} does nothing; @code{CTIME.SECONDS(@var{x})} is
821 equivalent to @code{@var{x}}.)
824 @node Date Construction
825 @subsubsection Functions that Produce Dates
826 @cindex dates, constructing
827 @cindex constructing dates
829 @cindex arguments, of date construction functions
830 These functions take numeric arguments and give numeric results that
831 represent dates. Arguments taken by these functions are:
835 Refers to a day of the month between 1 and 31. Day 0 is also accepted
836 and refers to the final day of the previous month. Days 29, 30, and
837 31 are accepted even in months that have fewer days and refer to a day
838 near the beginning of the following month.
841 Refers to a month of the year between 1 and 12. Months 0 and 13 are
842 also accepted and refer to the last month of the preceding year and
843 the first month of the following year, respectively.
846 Refers to a quarter of the year between 1 and 4. The quarters of the
847 year begin on the first day of months 1, 4, 7, and 10.
850 Refers to a week of the year between 1 and 53.
853 Refers to a day of the year between 1 and 366.
856 Refers to a year, 1582 or greater. Years between 0 and 99 are treated
857 according to the epoch set on SET EPOCH, by default beginning 69 years
858 before the current date (@pxref{SET EPOCH}).
861 @cindex arguments, invalid
862 If these functions' arguments are out-of-range, they are correctly
863 normalized before conversion to date format. Non-integers are rounded
866 @cindex day-month-year
867 @cindex dates, day-month-year
868 @deftypefn {Function} {} DATE.DMY (@var{day}, @var{month}, @var{year})
869 @deftypefnx {Function} {} DATE.MDY (@var{month}, @var{day}, @var{year})
870 Results in a date value corresponding to the midnight before day
871 @var{day} of month @var{month} of year @var{year}.
875 @cindex dates, month-year
876 @deftypefn {Function} {} DATE.MOYR (@var{month}, @var{year})
877 Results in a date value corresponding to the midnight before the first
878 day of month @var{month} of year @var{year}.
882 @cindex dates, quarter-year
883 @deftypefn {Function} {} DATE.QYR (@var{quarter}, @var{year})
884 Results in a date value corresponding to the midnight before the first
885 day of quarter @var{quarter} of year @var{year}.
889 @cindex dates, week-year
890 @deftypefn {Function} {} DATE.WKYR (@var{week}, @var{year})
891 Results in a date value corresponding to the midnight before the first
892 day of week @var{week} of year @var{year}.
896 @cindex dates, year-day
897 @deftypefn {Function} {} DATE.YRDAY (@var{year}, @var{yday})
898 Results in a date value corresponding to the day
899 @var{yday} of year @var{year}.
902 @node Date Extraction
903 @subsubsection Functions that Examine Dates
904 @cindex extraction, of dates
905 @cindex date examination
907 @cindex arguments, of date extraction functions
908 These functions take numeric arguments in PSPP date or time
909 format and give numeric results. These names are used for arguments:
913 A numeric value in PSPP date format.
916 A numeric value in PSPP time format.
919 A numeric value in PSPP time or date format.
923 @cindex dates, in days
924 @cindex time, in days
925 @deftypefn {Function} {} XDATE.DATE (@var{time-or-date})
926 For a time, results in the time corresponding to the number of whole
927 days @var{date-or-time} includes. For a date, results in the date
928 corresponding to the latest midnight at or before @var{date-or-time};
929 that is, gives the date that @var{date-or-time} is in.
933 @cindex dates, in hours
934 @cindex time, in hours
935 @deftypefn {Function} {} XDATE.HOUR (@var{time-or-date})
936 For a time, results in the number of whole hours beyond the number of
937 whole days represented by @var{date-or-time}. For a date, results in
938 the hour (as an integer between 0 and 23) corresponding to
942 @cindex day of the year
943 @cindex dates, day of the year
944 @deftypefn {Function} {} XDATE.JDAY (@var{date})
945 Results in the day of the year (as an integer between 1 and 366)
946 corresponding to @var{date}.
949 @cindex day of the month
950 @cindex dates, day of the month
951 @deftypefn {Function} {} XDATE.MDAY (@var{date})
952 Results in the day of the month (as an integer between 1 and 31)
953 corresponding to @var{date}.
957 @cindex dates, in minutes
958 @cindex time, in minutes
959 @deftypefn {Function} {} XDATE.MINUTE (@var{time-or-date})
960 Results in the number of minutes (as an integer between 0 and 59) after
961 the last hour in @var{time-or-date}.
965 @cindex dates, in months
966 @deftypefn {Function} {} XDATE.MONTH (@var{date})
967 Results in the month of the year (as an integer between 1 and 12)
968 corresponding to @var{date}.
972 @cindex dates, in quarters
973 @deftypefn {Function} {} XDATE.QUARTER (@var{date})
974 Results in the quarter of the year (as an integer between 1 and 4)
975 corresponding to @var{date}.
979 @cindex dates, in seconds
980 @cindex time, in seconds
981 @deftypefn {Function} {} XDATE.SECOND (@var{time-or-date})
982 Results in the number of whole seconds after the last whole minute (as
983 an integer between 0 and 59) in @var{time-or-date}.
987 @cindex times, in days
988 @deftypefn {Function} {} XDATE.TDAY (@var{date})
989 Results in the number of whole days from 14 Oct 1582 to @var{date}.
993 @cindex dates, time of day
994 @deftypefn {Function} {} XDATE.TIME (@var{date})
995 Results in the time of day at the instant corresponding to @var{date},
996 as a time value. This is the number of seconds since
997 midnight on the day corresponding to @var{date}.
1001 @cindex dates, in weeks
1002 @deftypefn {Function} {} XDATE.WEEK (@var{date})
1003 Results in the week of the year (as an integer between 1 and 53)
1004 corresponding to @var{date}.
1007 @cindex day of the week
1009 @cindex dates, day of the week
1010 @cindex dates, in weekdays
1011 @deftypefn {Function} {} XDATE.WKDAY (@var{date})
1012 Results in the day of week (as an integer between 1 and 7) corresponding
1013 to @var{date}, where 1 represents Sunday.
1017 @cindex dates, in years
1018 @deftypefn {Function} {} XDATE.YEAR (@var{date})
1019 Returns the year (as an integer 1582 or greater) corresponding to
1023 @node Miscellaneous Functions
1024 @subsection Miscellaneous Functions
1025 @cindex functions, miscellaneous
1027 Miscellaneous functions take various arguments and produce various
1030 @cindex cross-case function
1031 @cindex function, cross-case
1032 @deftypefn {Function} {} LAG (@var{variable}[, @var{ncases}])
1034 @var{variable} must be a numeric or string variable name. @code{LAG}
1035 results in the value of that variable for the case @var{ncases} before
1036 the current one. In case-selection procedures, @code{LAG} results in
1037 the value of the variable for the last case selected. Results in
1038 system-missing (for numeric variables) or blanks (for string
1039 variables) for the first case or before any cases are selected.
1041 If omitted, @var{ncases} defaults to 1. Otherwise, @var{ncases} must
1042 be a small positive constant integer. There is no explicit limit, but
1043 use of a large value will increase memory consumption.
1046 @cindex date, Julian
1048 @deftypefn {Function} {} YRMODA (@var{year}, @var{month}, @var{day})
1049 @var{year} is a year, either between 0 and 99 or at least 1582.
1050 Unlike other PSPP date functions, years between 0 and 99 always
1051 correspond to 1900 through 1999. @var{month} is a month between 1 and
1052 13. @var{day} is a day between 0 and 31. A @var{day} of 0 refers to
1053 the last day of the previous month, and a @var{month} of 13 refers to
1054 the first month of the next year. @var{year} must be in range.
1055 @var{year}, @var{month}, and @var{day} must all be integers.
1057 @code{YRMODA} results in the number of days between 15 Oct 1582 and
1058 the date specified, plus one. The date passed to @code{YRMODA} must be
1059 on or after 15 Oct 1582. 15 Oct 1582 has a value of 1.
1062 @node Statistical Distribution Functions
1063 @subsection Statistical Distribution Functions
1065 PSPP can calculate several functions of standard statistical
1066 distributions. These functions are named systematically based on the
1067 function and the distribution. The table below describes the
1068 statistical distribution functions in general:
1071 @item PDF.@var{dist} (@var{x}[, @var{param}@dots{}])
1072 Probability density function for @var{dist}. The domain of @var{x}
1073 depends on @var{dist}. For continuous distributions, the result is
1074 the density of the probability function at @var{x}, and the range is
1075 nonnegative real numbers. For discrete distributions, the result is
1076 the probability of @var{x}.
1078 @item CDF.@var{dist} (@var{x}[, @var{param}@dots{}])
1079 Cumulative distribution function for @var{dist}, that is, the
1080 probability that a random variate drawn from the distribution is less
1081 than @var{x}. The domain of @var{x} depends @var{dist}. The result is
1084 @item SIG.@var{dist} (@var{x}[, @var{param}@dots{})
1085 Tail probability function for @var{dist}, that is, the probability
1086 that a random variate drawn from the distribution is greater than
1087 @var{x}. The domain of @var{x} depends @var{dist}. The result is a
1088 probability. Only a few distributions include an SIG function.
1090 @item IDF.@var{dist} (@var{p}[, @var{param}@dots{}])
1091 Inverse distribution function for @var{dist}, the value of @var{x} for
1092 which the CDF would yield @var{p}. The value of @var{p} is a
1093 probability. The range depends on @var{dist} and is identical to the
1094 domain for the corresponding CDF.
1096 @item RV.@var{dist} ([@var{param}@dots{}])
1097 Random variate function for @var{dist}. The range depends on the
1100 @item NPDF.@var{dist} (@var{x}[, @var{param}@dots{}])
1101 Noncentral probability density function. The result is the density of
1102 the given noncentral distribution at @var{x}. The domain of @var{x}
1103 depends on @var{dist}. The range is nonnegative real numbers. Only a
1104 few distributions include an NPDF function.
1106 @item NCDF.@var{dist} (@var{x}[, @var{param}@dots{}])
1107 Noncentral cumulative distribution function for @var{dist}, that is,
1108 the probability that a random variate drawn from the given noncentral
1109 distribution is less than @var{x}. The domain of @var{x} depends
1110 @var{dist}. The result is a probability. Only a few distributions
1111 include an NCDF function.
1114 The individual distributions are described individually below.
1117 * Continuous Distributions::
1118 * Discrete Distributions::
1121 @node Continuous Distributions
1122 @subsubsection Continuous Distributions
1124 The following continuous distributions are available:
1126 @deftypefn {Function} {} PDF.BETA (@var{x})
1127 @deftypefnx {Function} {} CDF.BETA (@var{x}, @var{a}, @var{b})
1128 @deftypefnx {Function} {} IDF.BETA (@var{p}, @var{a}, @var{b})
1129 @deftypefnx {Function} {} RV.BETA (@var{a}, @var{b})
1130 @deftypefnx {Function} {} NPDF.BETA (@var{x}, @var{a}, @var{b}, @var{lambda})
1131 @deftypefnx {Function} {} NCDF.BETA (@var{x}, @var{a}, @var{b}, @var{lambda})
1132 Beta distribution with shape parameters @var{a} and @var{b}. The
1133 noncentral distribution takes an additional parameter @var{lambda}.
1134 Constraints: @var{a} > 0, @var{b} > 0, @var{lambda} >= 0, 0 <= @var{x}
1135 <= 1, 0 <= @var{p} <= 1.
1138 @deftypefn {Function} {} PDF.BVNOR (@var{x0}, @var{x1}, @var{rho})
1139 @deftypefnx {Function} {} CDF.VBNOR (@var{x0}, @var{x1}, @var{rho})
1140 Bivariate normal distribution of two standard normal variables with
1141 correlation coefficient @var{rho}. Two variates @var{x0} and @var{x1}
1142 must be provided. Constraints: 0 <= @var{rho} <= 1, 0 <= @var{p} <= 1.
1145 @deftypefn {Function} {} PDF.CAUCHY (@var{x}, @var{a}, @var{b})
1146 @deftypefnx {Function} {} CDF.CAUCHY (@var{x}, @var{a}, @var{b})
1147 @deftypefnx {Function} {} IDF.CAUCHY (@var{p}, @var{a}, @var{b})
1148 @deftypefnx {Function} {} RV.CAUCHY (@var{a}, @var{b})
1149 Cauchy distribution with location parameter @var{a} and scale
1150 parameter @var{b}. Constraints: @var{b} > 0, 0 < @var{p} < 1.
1153 @deftypefn {Function} {} PDF.CHISQ (@var{x}, @var{df})
1154 @deftypefnx {Function} {} CDF.CHISQ (@var{x}, @var{df})
1155 @deftypefnx {Function} {} SIG.CHISQ (@var{x}, @var{df})
1156 @deftypefnx {Function} {} IDF.CHISQ (@var{p}, @var{df})
1157 @deftypefnx {Function} {} RV.CHISQ (@var{df})
1158 @deftypefnx {Function} {} NPDF.CHISQ (@var{x}, @var{df}, @var{lambda})
1159 @deftypefnx {Function} {} NCDF.CHISQ (@var{x}, @var{df}, @var{lambda})
1160 Chi-squared distribution with @var{df} degrees of freedom. The
1161 noncentral distribution takes an additional parameter @var{lambda}.
1162 Constraints: @var{df} > 0, @var{lambda} > 0, @var{x} >= 0, 0 <=
1166 @deftypefn {Function} {} PDF.EXP (@var{x}, @var{a})
1167 @deftypefnx {Function} {} CDF.EXP (@var{x}, @var{a})
1168 @deftypefnx {Function} {} IDF.EXP (@var{p}, @var{a})
1169 @deftypefnx {Function} {} RV.EXP (@var{a})
1170 Exponential distribution with scale parameter @var{a}. The inverse of
1171 @var{a} represents the rate of decay. Constraints: @var{a} > 0,
1172 @var{x} >= 0, 0 <= @var{p} < 1.
1175 @deftypefn {Function} {} PDF.XPOWER (@var{x}, @var{a}, @var{b})
1176 @deftypefnx {Function} {} RV.XPOWER (@var{a}, @var{b})
1177 Exponential power distribution with positive scale parameter @var{a}
1178 and nonnegative power parameter @var{b}. Constraints: @var{a} > 0,
1179 @var{b} >= 0, @var{x} >= 0, 0 <= @var{p} <= 1. This distribution is a
1183 @deftypefn {Function} {} PDF.F (@var{x}, @var{df1}, @var{df2})
1184 @deftypefnx {Function} {} CDF.F (@var{x}, @var{df1}, @var{df2})
1185 @deftypefnx {Function} {} SIG.F (@var{x}, @var{df1}, @var{df2})
1186 @deftypefnx {Function} {} IDF.F (@var{p}, @var{df1}, @var{df2})
1187 @deftypefnx {Function} {} RV.F (@var{df1}, @var{df2})
1188 @deftypefnx {Function} {} NPDF.F (@var{x}, @var{df1}, @var{df2}, @var{lambda})
1189 @deftypefnx {Function} {} NCDF.F (@var{x}, @var{df1}, @var{df2}, @var{lambda})
1190 F-distribution of two chi-squared deviates with @var{df1} and
1191 @var{df2} degrees of freedom. The noncentral distribution takes an
1192 additional parameter @var{lambda}. Constraints: @var{df1} > 0,
1193 @var{df2} > 0, @var{lambda} >= 0, @var{x} >= 0, 0 <= @var{p} < 1.
1196 @deftypefn {Function} {} PDF.GAMMA (@var{x}, @var{a}, @var{b})
1197 @deftypefnx {Function} {} CDF.GAMMA (@var{x}, @var{a}, @var{b})
1198 @deftypefnx {Function} {} IDF.GAMMA (@var{p}, @var{a}, @var{b})
1199 @deftypefnx {Function} {} RV.GAMMA (@var{a}, @var{b})
1200 Gamma distribution with shape parameter @var{a} and scale parameter
1201 @var{b}. Constraints: @var{a} > 0, @var{b} > 0, @var{x} >= 0, 0 <=
1205 @deftypefn {Function} {} PDF.HALFNRM (@var{x}, @var{a}, @var{b})
1206 @deftypefnx {Function} {} CDF.HALFNRM (@var{x}, @var{a}, @var{b})
1207 @deftypefnx {Function} {} IDF.HALFNRM (@var{p}, @var{a}, @var{b})
1208 @deftypefnx {Function} {} RV.HALFNRM (@var{a}, @var{b})
1209 Half-normal distribution with location parameter @var{a} and shape
1210 parameter @var{b}. Constraints: @var{b} > 0, 0 < @var{p} < 1.
1213 @deftypefn {Function} {} PDF.IGAUSS (@var{x}, @var{a}, @var{b})
1214 @deftypefnx {Function} {} CDF.IGAUSS (@var{x}, @var{a}, @var{b})
1215 @deftypefnx {Function} {} IDF.IGAUSS (@var{p}, @var{a}, @var{b})
1216 @deftypefnx {Function} {} RV.IGAUSS (@var{a}, @var{b})
1217 Inverse Gaussian distribution with parameters @var{a} and @var{b}.
1218 Constraints: @var{a} > 0, @var{b} > 0, @var{x} > 0, 0 <= @var{p} < 1.
1221 @deftypefn {Function} {} PDF.LANDAU (@var{x})
1222 @deftypefnx {Function} {} RV.LANDAU ()
1223 Landau distribution.
1226 @deftypefn {Function} {} PDF.LAPLACE (@var{x}, @var{a}, @var{b})
1227 @deftypefnx {Function} {} CDF.LAPLACE (@var{x}, @var{a}, @var{b})
1228 @deftypefnx {Function} {} IDF.LAPLACE (@var{p}, @var{a}, @var{b})
1229 @deftypefnx {Function} {} RV.LAPLACE (@var{a}, @var{b})
1230 Laplace distribution with location parameter @var{a} and scale
1231 parameter @var{b}. Constraints: @var{b} > 0, 0 < @var{p} < 1.
1234 @deftypefn {Function} {} RV.LEVY (@var{c}, @var{alpha})
1235 Levy symmetric alpha-stable distribution with scale @var{c} and
1236 exponent @var{alpha}. Constraints: 0 < @var{alpha} <= 2.
1239 @deftypefn {Function} {} RV.LVSKEW (@var{c}, @var{alpha}, @var{beta})
1240 Levy skew alpha-stable distribution with scale @var{c}, exponent
1241 @var{alpha}, and skewness parameter @var{beta}. Constraints: 0 <
1242 @var{alpha} <= 2, -1 <= @var{beta} <= 1.
1245 @deftypefn {Function} {} PDF.LOGISTIC (@var{x}, @var{a}, @var{b})
1246 @deftypefnx {Function} {} CDF.LOGISTIC (@var{x}, @var{a}, @var{b})
1247 @deftypefnx {Function} {} IDF.LOGISTIC (@var{p}, @var{a}, @var{b})
1248 @deftypefnx {Function} {} RV.LOGISTIC (@var{a}, @var{b})
1249 Logistic distribution with location parameter @var{a} and scale
1250 parameter @var{b}. Constraints: @var{b} > 0, 0 < @var{p} < 1.
1253 @deftypefn {Function} {} PDF.LNORMAL (@var{x}, @var{a}, @var{b})
1254 @deftypefnx {Function} {} CDF.LNORMAL (@var{x}, @var{a}, @var{b})
1255 @deftypefnx {Function} {} IDF.LNORMAL (@var{p}, @var{a}, @var{b})
1256 @deftypefnx {Function} {} RV.LNORMAL (@var{a}, @var{b})
1257 Lognormal distribution with parameters @var{a} and @var{b}.
1258 Constraints: @var{a} > 0, @var{b} > 0, @var{x} >= 0, 0 <= @var{p} < 1.
1261 @deftypefn {Function} {} PDF.NORMAL (@var{x}, @var{mu}, @var{sigma})
1262 @deftypefnx {Function} {} CDF.NORMAL (@var{x}, @var{mu}, @var{sigma})
1263 @deftypefnx {Function} {} IDF.NORMAL (@var{p}, @var{mu}, @var{sigma})
1264 @deftypefnx {Function} {} RV.NORMAL (@var{mu}, @var{sigma})
1265 Normal distribution with mean @var{mu} and standard deviation
1266 @var{sigma}. Constraints: @var{b} > 0, 0 < @var{p} < 1. Three
1267 additional functions are available as shorthand:
1269 @deftypefn {Function} {} CDFNORM (@var{x})
1270 Equivalent to CDF.NORMAL(@var{x}, 0, 1).
1273 @deftypefn {Function} {} PROBIT (@var{p})
1274 Equivalent to IDF.NORMAL(@var{p}, 0, 1).
1277 @deftypefn {Function} {} NORMAL (@var{sigma})
1278 Equivalent to RV.NORMAL(0, @var{sigma}).
1282 @deftypefn {Function} {} PDF.NTAIL (@var{x}, @var{a}, @var{sigma})
1283 @deftypefnx {Function} {} RV.NTAIL (@var{a}, @var{sigma})
1284 Normal tail distribution with lower limit @var{a} and standard
1285 deviation @var{sigma}. This distribution is a PSPP extension.
1286 Constraints: @var{a} > 0, @var{x} > @var{a}, 0 < @var{p} < 1.
1289 @deftypefn {Function} {} PDF.PARETO (@var{x}, @var{a}, @var{b})
1290 @deftypefnx {Function} {} CDF.PARETO (@var{x}, @var{a}, @var{b})
1291 @deftypefnx {Function} {} IDF.PARETO (@var{p}, @var{a}, @var{b})
1292 @deftypefnx {Function} {} RV.PARETO (@var{a}, @var{b})
1293 Pareto distribution with threshold parameter @var{a} and shape
1294 parameter @var{b}. Constraints: @var{a} > 0, @var{b} > 0, @var{x} >=
1295 @var{a}, 0 <= @var{p} < 1.
1298 @deftypefn {Function} {} PDF.RAYLEIGH (@var{x}, @var{sigma})
1299 @deftypefnx {Function} {} CDF.RAYLEIGH (@var{x}, @var{sigma})
1300 @deftypefnx {Function} {} IDF.RAYLEIGH (@var{p}, @var{sigma})
1301 @deftypefnx {Function} {} RV.RAYLEIGH (@var{sigma})
1302 Rayleigh distribution with scale parameter @var{sigma}. This
1303 distribution is a PSPP extension. Constraints: @var{sigma} > 0,
1307 @deftypefn {Function} {} PDF.RTAIL (@var{x}, @var{a}, @var{sigma})
1308 @deftypefnx {Function} {} RV.RTAIL (@var{a}, @var{sigma})
1309 Rayleigh tail distribution with lower limit @var{a} and scale
1310 parameter @var{sigma}. This distribution is a PSPP extension.
1311 Constraints: @var{a} > 0, @var{sigma} > 0, @var{x} > @var{a}.
1314 @deftypefn {Function} {} CDF.SMOD (@var{x}, @var{a}, @var{b})
1315 @deftypefnx {Function} {} IDF.SMOD (@var{p}, @var{a}, @var{b})
1316 Studentized maximum modulus distribution with parameters @var{a} and
1317 @var{b}. Constraints: @var{a} > 0, @var{b} > 0, @var{x} > 0, 0 <=
1321 @deftypefn {Function} {} CDF.SRANGE (@var{x}, @var{a}, @var{b})
1322 @deftypefnx {Function} {} IDF.SRANGE (@var{p}, @var{a}, @var{b})
1323 Studentized range distribution with parameters @var{a} and @var{b}.
1324 Constraints: @var{a} >= 1, @var{b} >= 1, @var{x} > 0, 0 <= @var{p} <
1328 @deftypefn {Function} {} PDF.T (@var{x}, @var{df})
1329 @deftypefnx {Function} {} CDF.T (@var{x}, @var{df})
1330 @deftypefnx {Function} {} IDF.T (@var{p}, @var{df})
1331 @deftypefnx {Function} {} RV.T (@var{df})
1332 @deftypefnx {Function} {} NPDF.T (@var{x}, @var{df}, @var{lambda})
1333 @deftypefnx {Function} {} NCDF.T (@var{x}, @var{df}, @var{lambda})
1334 T-distribution with @var{df} degrees of freedom. The noncentral
1335 distribution takes an additional parameter @var{lambda}. Constraints:
1336 @var{df} > 0, 0 < @var{p} < 1.
1339 @deftypefn {Function} {} PDF.T1G (@var{x}, @var{a}, @var{b})
1340 @deftypefnx {Function} {} CDF.T1G (@var{x}, @var{a}, @var{b})
1341 @deftypefnx {Function} {} IDF.T1G (@var{p}, @var{a}, @var{b})
1342 Type-1 Gumbel distribution with parameters @var{a} and @var{b}. This
1343 distribution is a PSPP extension. Constraints: 0 < @var{p} < 1.
1346 @deftypefn {Function} {} PDF.T2G (@var{x}, @var{a}, @var{b})
1347 @deftypefnx {Function} {} CDF.T2G (@var{x}, @var{a}, @var{b})
1348 @deftypefnx {Function} {} IDF.T2G (@var{p}, @var{a}, @var{b})
1349 Type-2 Gumbel distribution with parameters @var{a} and @var{b}. This
1350 distribution is a PSPP extension. Constraints: @var{x} > 0, 0 <
1354 @deftypefn {Function} {} PDF.UNIFORM (@var{x}, @var{a}, @var{b})
1355 @deftypefnx {Function} {} CDF.UNIFORM (@var{x}, @var{a}, @var{b})
1356 @deftypefnx {Function} {} IDF.UNIFORM (@var{p}, @var{a}, @var{b})
1357 @deftypefnx {Function} {} RV.UNIFORM (@var{a}, @var{b})
1358 Uniform distribution with parameters @var{a} and @var{b}.
1359 Constraints: @var{a} <= @var{x} <= @var{b}, 0 <= @var{p} <= 1. An
1360 additional function is available as shorthand:
1362 @deftypefn {Function} {} UNIFORM (@var{b})
1363 Equivalent to RV.UNIFORM(0, @var{b}).
1367 @deftypefn {Function} {} PDF.WEIBULL (@var{x}, @var{a}, @var{b})
1368 @deftypefnx {Function} {} CDF.WEIBULL (@var{x}, @var{a}, @var{b})
1369 @deftypefnx {Function} {} IDF.WEIBULL (@var{p}, @var{a}, @var{b})
1370 @deftypefnx {Function} {} RV.WEIBULL (@var{a}, @var{b})
1371 Weibull distribution with parameters @var{a} and @var{b}.
1372 Constraints: @var{a} > 0, @var{b} > 0, @var{x} >= 0, 0 <= @var{p} < 1.
1375 @node Discrete Distributions
1376 @subsubsection Discrete Distributions
1378 The following discrete distributions are available:
1380 @deftypefn {Function} {} PDF.BERNOULLI (@var{x})
1381 @deftypefnx {Function} {} CDF.BERNOULLI (@var{x}, @var{p})
1382 @deftypefnx {Function} {} RV.BERNOULLI (@var{p})
1383 Bernoulli distribution with probability of success @var{p}.
1384 Constraints: @var{x} = 0 or 1, 0 <= @var{p} <= 1.
1387 @deftypefn {Function} {} PDF.BINOMIAL (@var{x}, @var{n}, @var{p})
1388 @deftypefnx {Function} {} CDF.BINOMIAL (@var{x}, @var{n}, @var{p})
1389 @deftypefnx {Function} {} RV.BINOMIAL (@var{n}, @var{p})
1390 Binomial distribution with @var{n} trials and probability of success
1391 @var{p}. Constraints: integer @var{n} > 0, 0 <= @var{p} <= 1, integer
1395 @deftypefn {Function} {} PDF.GEOM (@var{x}, @var{n}, @var{p})
1396 @deftypefnx {Function} {} CDF.GEOM (@var{x}, @var{n}, @var{p})
1397 @deftypefnx {Function} {} RV.GEOM (@var{n}, @var{p})
1398 Geometric distribution with probability of success @var{p}.
1399 Constraints: 0 <= @var{p} <= 1, integer @var{x} > 0.
1402 @deftypefn {Function} {} PDF.HYPER (@var{x}, @var{a}, @var{b}, @var{c})
1403 @deftypefnx {Function} {} CDF.HYPER (@var{x}, @var{a}, @var{b}, @var{c})
1404 @deftypefnx {Function} {} RV.HYPER (@var{a}, @var{b}, @var{c})
1405 Hypergeometric distribution when @var{b} objects out of @var{a} are
1406 drawn and @var{c} of the available objects are distinctive.
1407 Constraints: integer @var{a} > 0, integer @var{b} <= @var{a}, integer
1408 @var{c} <= @var{a}, integer @var{x} >= 0.
1411 @deftypefn {Function} {} PDF.LOG (@var{x}, @var{p})
1412 @deftypefnx {Function} {} RV.LOG (@var{p})
1413 Logarithmic distribution with probability parameter @var{p}.
1414 Constraints: 0 <= @var{p} < 1, @var{x} >= 1.
1417 @deftypefn {Function} {} PDF.NEGBIN (@var{x}, @var{n}, @var{p})
1418 @deftypefnx {Function} {} CDF.NEGBIN (@var{x}, @var{n}, @var{p})
1419 @deftypefnx {Function} {} RV.NEGBIN (@var{n}, @var{p})
1420 Negative binomial distribution with number of successes paramter
1421 @var{n} and probability of success parameter @var{p}. Constraints:
1422 integer @var{n} >= 0, 0 < @var{p} <= 1, integer @var{x} >= 1.
1425 @deftypefn {Function} {} PDF.POISSON (@var{x}, @var{mu})
1426 @deftypefnx {Function} {} CDF.POISSON (@var{x}, @var{mu})
1427 @deftypefnx {Function} {} RV.POISSON (@var{mu})
1428 Poisson distribution with mean @var{mu}. Constraints: @var{mu} > 0,
1429 integer @var{x} >= 0.
1432 @node Order of Operations
1433 @section Operator Precedence
1434 @cindex operator precedence
1435 @cindex precedence, operator
1436 @cindex order of operations
1437 @cindex operations, order of
1439 The following table describes operator precedence. Smaller-numbered
1440 levels in the table have higher precedence. Within a level,
1441 operations are always performed from left to right. The first
1442 occurrence of @samp{-} represents unary negation, the second binary
1457 @code{EQ GE GT LE LT NE}
1461 @setfilename ignored