Bewerken

Delen via


WorksheetFunction.Forecast(Double, Object, Object) Method

Definition

Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value. The known values are existing x-values and y-values, and the new value is predicted by using linear regression. You can use this function to predict future sales, inventory requirements, or consumer trends.

public:
 double Forecast(double Arg1, System::Object ^ Arg2, System::Object ^ Arg3);
public double Forecast (double Arg1, object Arg2, object Arg3);
Public Function Forecast (Arg1 As Double, Arg2 As Object, Arg3 As Object) As Double

Parameters

Arg1
Double

X - the data point for which you want to predict a value.

Arg2
Object

Known_y's - the dependent array or range of data.

Arg3
Object

Known_x's - the independent array or range of data.

Returns

Remarks

If x is nonnumeric, Forecast returns the #VALUE! error value.

If known_y's and known_x's are empty or contain a different number of data points, Forecast returns the #N/A error value.

If the variance of known_x's equals zero, then Forecast returns the #DIV/0! error value.

The equation for Forecast is a+bx, where:

Figure 1: Equation for the Forecast method

And:

Figure 2: Equation for the Forecast method

and where x and y are the sample means AVERAGE(known_x's) and AVERAGE(known y's).

Applies to