|
NAMEStatistics::Forecast - calculates a future value DESCRIPTIONThis is a dummy Oriented Object module that calculates a future value by using existing values. The new value is calculated by using linear regression. SYNOPSISuse Statistics::Forecast; Create forecast object my $FCAST = Statistics::Forecast->new("My Forecast Name");
Add data $FCAST->{DataX} = \@Array_X;
$FCAST->{DataY} = \@Array_Y;
$FCAST->{NextX} = $NextX;
Calculate the result $FCAST->calc; Get the result my $Result_Forecast = $FCAST->{ForecastY);
INTERNALSThe equation for Forecast is: a+bx, where 'x' is the predicted value and
_ _
a = y + bx
b = sum((x+x)(y-y))/sum(x-x)**2
METHODS
EXAMPLE use Statistics::Forecast;
my @Y = (1,3,7,12);
my @X = (1,2,3,4);
my $FCAST = Statistics::Forecast->new("My Forecast");
$FCAST->{DataX} = \@X;
$FCAST->{DataY} = \@Y;
$FCAST->{NextX} = 8;
$FCAST->calc;
print "The Forecast ", $FCAST->{ForecastName};
print " has the forecast value: ", $FCAST->{ForecastY}, "\n";
AUTHORThis module was developed by Alex Falcao (alexjfalcao@hotmail.com) STATUS OF THE MODULEThis is the first version and calculates forecast value. VERSION0.3 COPYRIGHTThis module is released for free public use under a GPL license.
|