Statistics::ForecastStatistics::Forecast is a Perl module that calculates a future value. | |
Download |
Statistics::Forecast Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Alex Falcao
- Publisher web site:
- http://search.cpan.org/~falcao/Statistics-Forecast-0.3/Forecast.pm
Statistics::Forecast Tags
Statistics::Forecast Description
Statistics::Forecast is a Perl module that calculates a future value. Statistics::Forecast is a Perl module that calculates a future value.This is a dummy Oriented Object module that calculates a future value by using existing values. The new value is calculated by using linear regression.SYNOPSIS use 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)**2METHODSnewReceives a forecast name, only to remember and returns the blessed data structure as a Statistics::Forecast object. my $FCAST = Statistics::Forecast->new("My Forecast");calcCalculate and return the forecast value. $FCAST->calc;dumpPrints data for debuging propose. $FCAST->dump;SumXReturns the sum of X values. my $SumOfX = $FCAST->{SumX};SumYReturns the sum of Y values. my $SumOfY = $FCAST->{SumY};SumXXReturns the sum of X**2 values. my $SumOfXX = $FCAST->{SumXX};SumXYReturns the sum of X * Y values. my $SumOfXY = $FCAST->{SumXY};AvgXReturns the average of X values. my $AvgX = $FCAST->{AvgX};AvgYReturns the average of Y values. my $AvgY = $FCAST->{AvgY};NReturn the number of X values. my $N = $FCAST->{N};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";Requirements:· Perl Requirements: · Perl
Statistics::Forecast Related Software