BBS: Inland Empire Archive Date: 04-14-92 (14:11) Number: 196 From: DON KROUSE Refer#: NONE To: JEAN CREPEAU Recvd: NO Subj: Regression Conf: (2) Quik_Bas

JC>DK=> Does anyone know were I might find source code for a multiple JC> regression routine? JC>DK=> I am particularly interested in a routine that does Linear, Log, JC> Exponential, Power, etc. and that optimizes the order in which the JC> dependent variables are included. JC>Use the following formula JC> m=(n*SUM(x*y) - SUM(x)*(SUM(y))/(n*SUM(x*x) - SUM(x)*SUM(x)) JC> b=(SUM(y)-m*SUM(x))/n JC> where n=# of samples JC> Your linear equation is y=mx+b Hi Jean, Thank you for taking the time to answer my request for help. Your approach and code are "very good" for simple regression. What I am looking for though is a "Multiple Regression" routine. That is a routine that will determine the regression formula for a dependent variable with multiple independent variables. Silly Example: y = Store profit x1 = Store sq. ft x2 = no. of employees x3 = Store hours x4 = Sales The data is used to calculate the summary statistics, i.e: sum(y), sum(x1), sum(x2), sum(x1y), etc. The summary statistics are used in a set of "normal equations" which much be solved simultaneously to determine the regression coefficients. The linear regression equation would be similar to the one that you show above. y = m1x1 + m2x2 + m3x3 + m4x4 + b PROBLEMS: - The number of summary statistics that must be computed grows unmanagable as predictors are added. - The order in which the predictor variables are included in the regression affects how well the regression line will fit the data. - The number of normal equations which must be solved grows as predictors are added. i.e. no. of equations = no. of predictors + 1 - For non linear regression a method of simultaneously solving non-linear equations is necessary. I'm trying to write a business program not a stastics program. This would be an important part but not the essence of the program. If I have to do all of this from scratch I'll probably put it off for a long time. (Forever's a long time isn't it?) I believe that BASIC is/was used by a lot of scientific types who must have crossed this bridge before. I was hoping to find someone who might have or know of some off the shelf code. It might not sound like it, but I really do appreciate your taking the time to help. Don --- * Origin: Silver Lake Systems * Bothell, WA (1:343/58)

Echo Basic Postings

**Books at Amazon:**

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET