Statistics::OLS

Statistics::OLS is a Perl module to perform ordinary least squares and associated statistics.
Download

Statistics::OLS Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Sanford Morton
  • Publisher web site:
  • http://search.cpan.org/~smorton/Statistics-OLS-0.07/OLS.pm

Statistics::OLS Tags


Statistics::OLS Description

Statistics::OLS is a Perl module to perform ordinary least squares and associated statistics. Statistics::OLS is a Perl module to perform ordinary least squares and associated statistics.SYNOPSIS use Statistics::OLS; my $ls = Statistics::OLS->new(); $ls->setData (@xydataset) or die( $ls->error() ); $ls->setData (@xdataset, @ydataset); $ls->regress(); my ($intercept, $slope) = $ls->coefficients(); my $R_squared = $ls->rsq(); my ($tstat_intercept, $tstat_slope) = $ls->tstats(); my $sigma = $ls->sigma(); my $durbin_watson = $ls->dw(); my $sample_size = $ls->size(); my ($avX, $avY) = $ls->av(); my ($varX, $varY, $covXY) = $ls->var(); my ($xmin, $xmax, $ymin, $ymax) = $ls->minMax(); # returned arrays are x-y or y-only data # depending on initial call to setData() my @predictedYs = $ls->predicted(); my @residuals = $ls->residuals();I wrote Statistics::OLS to perform Ordinary Least Squares (linear curve fitting) on two dimensional data: y = a + bx. The other simple statistical module I found on CPAN (Statistics::Descriptive) is designed for univariate analysis. It accomodates OLS, but somewhat inflexibly and without rich bivariate statistics. Nevertheless, it might make sense to fold OLS into that module or a supermodule someday.Statistics::OLS computes the estimated slope and intercept of the regression line, their T-statistics, R squared, standard error of the regression and the Durbin-Watson statistic. It can also return the residuals.It is pretty simple to do two dimensional least squares, but much harder to do multiple regression, so OLS is unlikely ever to work with multiple independent variables.This is a beta code and has not been extensively tested. It has worked on a few published datasets. Feedback is welcome, particularly if you notice an error or try it with known results that are not reproduced correctly.Requirements:· Perl Requirements: · Perl


Statistics::OLS Related Software