TREND

Syntax:

TREND ( known-ys [ , [ known-xs ] [ , [ new-xs ] [ , const-flag ] ] )

Description: Computes values along a linear trend. Fits a straight line (using the method of least squares) to the arrays known-ys and known-xs. The y-values along that line for the array of new-xs specified.

Arguments:

Name

Type

Description

known-ys

array

The set of y-values already known in the relationship y=mx+b. If that array is in a single column, each column of known-xs is interpreted as a separate variable. If that array is in a single row, each row of known-xs is interpreted as a separate variable.

known-xs

array

An optional set of x-values that might already be known in the relationship y=mx+b. The array known-xs can include one or more sets of variables. If only one variable is used, known-ys and known-xs can be ranges of any shape, as long as they have equal dimensions. If more than one variable is used, known-ys shall be a vector. If known-xs is omitted, it is assumed to be the array {1,2,3,...} that is the same size as known-ys.

new-xs

array

New x-values for which TREND is to return corresponding y-values. new-xs shall include a column (or row) for each independent variable, just as known-xs does. So, if known-ys is in a single column, known-xs and new-xs shall have the same number of columns. If known-ys is in a single row, known-xs and new-xs shall have the same number of rows. If new-xs is omitted, it is assumed to be the same as known-xs. If both known-xs and new-xs are omitted, they are assumed to be the array {1,2,3,...} that is the same size as known-ys.

const-flag

logical

Specifies whether to force the constant b to equal 0. If TRUE or omitted, b is calculated normally. If FALSE, b is set equal to 0 and the m-values are adjusted so that y=mx.

Return Type and Value: array – The values along a linear trend, as an array of numbers.