WorksheetFunction.LinEst (Excel)

Calculates the statistics for a line by using the least squares method to calculate a straight line that best fits your data, and returns an array that describes the line. Because this function returns an array of values, it must be entered as an array formula.

The equation for the line is y = mx + b or y = m1x1 + m2x2 + ... + b (if there are multiple ranges of x-values), where the dependent y-value is a function of the independent x-values. The m-values are coefficients corresponding to each x-value, and b is a constant value. Note that y, x, and m can be vectors. The array that LinEst returns is {mn,mn-1,...,m1,b}. LinEst can also return additional regression statistics. If the array known_y's is in a single column, each column of known_x's is interpreted as a separate variable. If the array known_y's is in a single row, each row of known_x's is interpreted as a separate variable. The array known_x's can include one or more sets of variables. If only one variable is used, known_y's and known_x's can be ranges of any shape, as long as they have equal dimensions. If more than one variable is used, known_y's must be a vector (that is, a range with a height of one row or a width of one column). If known_x's is omitted, it is assumed to be the array {1,2,3,...} that is the same size as known_y's.

LinEst (Arg1, Arg2, ..., Arg4)


Dim arrLinEst() As Variant
arrLinEst() = WorksheetFunction.LinEst(Arg1:=)

Arguments

Arg1, Arg2, ..., Arg4

Arg1 - Known_y's - the set of y-values that you already know in the relationship y = mx + b

Arg2 - Known_x's - an optional set of x-values that you may already know in the relationship y = mx + b

Arg3 - Const - a logical value specifying whether to force the constant b to equal 0

Arg4 - Stats - a logical value specifying whether to return additional regression statistics