Developer Forums | About Us | Site Map


Useful Lists

Web Host
site hosted by netplex

Online Manuals

Simple linear regression with PHP: Part 1
By Paul Meagher - 2004-05-12 Page:  1 2 3 4 5 6 7 8


In contrast with other open source languages like Perl and Python, PHP lacks a robust community effort to develop a math library.

One reason for this state of affairs may the abundance of existing sophisticated math tools that might dwarf any home-grown PHP effort. For example, a powerful tool that I've been researching, the S System, has an impressive array of statistical libraries designed for analyzing datasets and was awarded an ACM Award in 1998 for its language design. If S or its opensource cousin R is merely an exec_shell call away, why bother implementing the same statistical computing functionality in PHP? For more on the S System, its ACM Award, or R, see Resources.

After all, isn't this a waste of developer effort? If the motivations for developing a PHP math library are bounded by concerns for conserving developer effort and using the best tool for the job, then PHP's present course makes sense.

On the other hand, educational motivations might inspire the development of a PHP math library. For about 10 percent of the population, mathematics is an interesting topic to explore. For those who are also fluent in PHP, the development of a PHP math library can reinforce the mathematics learning process -- in other words, don't just read a chapter on T tests, implement a class that computes the relevant intermediate values and displays them in a standard format.

With guidance and coaching, I hope to demonstrate that developing PHP math libraries is not a difficult task and may represent an interesting technical and learning challenge. In this article, I'll provide an example of a PHP math library called SimpleLinearRegression that demonstrates a general approach that can be used to develop PHP math libraries. Let's begin by discussing some general principles that guided my development of this SimpleLinearRegression class.

View Simple linear regression with PHP: Part 1 Discussion

Page:  1 2 3 4 5 6 7 8 Next Page: Guiding principles

First published by IBM developerWorks

Copyright 2004-2024 All rights reserved.
Article copyright and all rights retained by the author.