Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

# Statistics::OLS 0.07

Date Added: July 04, 2010  |  Visits: 762

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: No special requirements Platforms: Linux Keyword: Associated,  Least Squares,  Libraries,  Module,  Ols,  Ordinary,  Ordinary Least Squares,  Perform,  Perl,  Perl Module,  Programming,  Squares,  Statisticsols Users rating: 0/10