> Script Details
Linear Regression (bivariate)
report inappropriate content
Dr Michael Sawada
Sep 29 2002
Status of work
ArcScripts is intended for the free exchange of scripts and tools related to ESRI software products. Please alert the moderator if this script is a demo, trial-version, or an advertisement for a retail product.
This program presents a user interface with a dropdown list of all point/polygon/line layers in the current DataFrame and allows the computation of Simple Linear Regression (bivariate) between two numeric attributes. The program provides
a) a complete set of statistics in including calculated t-values and p-values (from Student's t distribution) for slope and intercept and correlation coefficient and R2 amongst others in the form of a Stand Alone Table within the current dataframe.
b) Four new fields in the feature table are added that contain the estimated best fit line [Fit], upper [HIGH95] and lower [LOW95] confidence intervals and calculated residuals [RESIDUALS]
c) Optional automatic generation scatterplots of the regressed variables with the best fit line
d) Optional automatic generation residual diagnostic plot
e) Optional (default) calculations only on selected subset of layer features.
f) Optional automatic mapping of residuals using standard deviation classes.
NOTE: The general use of the program is described in the readme.pdf file distributed with the dll. Important details of use and validation are described in that document.
The program by default outputs (as a minimum) the following parameter estimates (you are presented with save an options).
SLOPE (BETA) 0.953446
Student's t-value of Beta 34.276996
Standard Error of Beta 0.027816
p-value Beta [Ho b=0] 0.000000
Y INTERCEPT 321.775119
Student's t-value of Intercept 2.612878
Standard Error of Intercept 123.149685
p-value Intercept [Ho b=0] 0.009856
CORRELATION (R) 0.939568
Student's t-value of R 34.276996
p-value R [Ho = 0; df = n-1] 0.000000
Standard Error of XY 566.088813
Number of Observations (n) 158.000000
Mean X-Variable 4120.645570
Mean Y-Variable 4250.588608
Sum of x-values 651062.000000
Sum of x-values squared (x^2) 3096969280.000000
Student's p-values are calculated based on n-2 degrees of freedom from the t-distribution and are accurate to 5 decimal places. If there is a p-value of zero then you may assume that the probability is less than 0.0001.
Written in Visual Basic and requires ArcGIS 8.1. A single DLL is loaded:
1) Extract the .dll from the zipped file and place it in a folder on your harddrive (remember where you've put it!). The file is called regress.dll
2) Load the .dll into ArcMap by
a. Right clicking on any gray area in the menu bar
b. Select Customize… from the 'pop-up' menu
c. Select the Commands tab at the top of the dialog box.
d. Select the "Add from file" button.
e. Navigate to the folder where the regress.dll was placed and double-click on it.
f. Under the categories, click on Sawada and you will see an icon for the Standard Distance. DON'T CLICK THE CLOSE BUTTON YET!!!!
g. Next, click on the drop-down arrow in the bottom left corner and ensure that it says "Normal.mxt"
h. Now, drag that Icon to one of the button-bars in ArcGIS
i. Click "Close"...
the complete description can be found in the readme.txt file included in the zipfile download.