Granato, G.E., 2006, Kendall-Theil Robust Line (KTRLine--version 1.0)—A visual basic program for calculating and graphing robust nonparametric estimates of linear-regression coefficients between two continuous variables: Techniques and Methods of the U.S. Geological Survey, book 4, chap. A7, 31 p. Report On-Line Compiled Software On-Line
The Kendall-Theil Robust Line software (KTRLine—version 1.0) is a Visual Basic program that may be used with the Microsoft Windows operating system to calculate parameters for robust, nonparametric estimates of linear-regression coefficients between two continuous variables. The KTRLine software was developed by the U.S. Geological Survey, in cooperation with the Federal Highway Administration, for use in stochastic data modeling with local, regional, and national hydrologic data sets to develop planning-level estimates of potential effects of highway runoff on the quality of receiving waters. The Kendall-Theil robust line was selected because this robust nonparametric method is resistant to the effects of outliers and nonnormality in residuals that commonly characterize hydrologic data sets. The slope of the line is calculated as the median of all possible pairwise slopes between points. The intercept is calculated so that the line will run through the median of input data. A single-line model or a multisegment model may be specified.
The program was developed to provide regression equations with an error component for stochastic data generation because nonparametric multisegment regression tools are not available with the software that is commonly used to develop regression models. The Kendall-Theil robust line is a median line and, therefore, may underestimate total mass, volume, or loads unless the error component or a bias correction factor is incorporated into the estimate. Regression statistics such as the median error, the median absolute deviation, the prediction error sum of squares, the root mean square error, the confidence interval for the slope, and the bias correction factor for median estimates are calculated by use of nonparametric methods. These statistics, however, may be used to formulate estimates of mass, volume, or total loads.
The program is used to read a two- or three-column tab-delimited input file with variable names in the first row and data in subsequent rows. The user may choose the columns that contain the independent (X) and dependent (Y) variable. A third column, if present, may contain metadata such as the sample-collection location and date. The program screens the input files and plots the data. The KTRLine software is a graphical tool that facilitates development of regression models by use of graphs of the regression line with data, the regression residuals (with X or Y), and percentile plots of the cumulative frequency of the X variable, Y variable, and the regression residuals. The user may individually transform the independent and dependent variables to reduce heteroscedasticity and to linearize data. The program plots the data and the regression line. The program also prints model specifications and regression statistics to the screen. The user may save and print the regression results. The program can accept data sets that contain up to about 15,000 XY data points, but because the program must sort the array of all pairwise slopes, the program may be perceptibly slow with data sets that contain more than about 1,000 points.
KTRLine version 1.0 - Initial release. October 1, 2006
The KTRLine program is written in Visual Basic 6.0 and therefore use is limited to Microsoft Windows operating systems. The graphical display forms require a screen resolution exceeding 1024 x 768 pixels.
The KTRLine program uses a two- or three-column tab-delimited text file with an independent (X) variable, dependent (Y) variable, and a meta-data column. The user may specify the X and Y columns when the file is loaded. The X and Y data can have a heading line, but all the other values must be numbers. The metadata column can be in any format; these data will be displayed on the graph when the user right-clicks on a data point.
Input: Example Data Sets from Station 01197500 Housatonic River near Great Barrington, MA
- 01197500D.txt -- Streamflow and suspended-sediment concentrations (data used as example in the report)
- 01197500DA.txt -- Streamflow per unit area and suspended-sediment concentrations
- 01197500TP.txt -- Streamflow and total phosphorus concentrations
- 01197500TPA.txt -- Streamflow per unit area and total phosphorus concentrations
Output: Example Files from Analysis of Example Data
The program creates an output file with the regression statistics. The user also can print the graphing and model-specification form.
- 01197500D-KT.txt -- One-segment and multi-segment regression statistics for streamflow and suspended-sediment concentrations (data used as example in the report)
- 01197500TPA-KT.txt -- One-segment regression statistics for treamflow per unit area and total phosphorus concentrations
Source Code (Version 1.0)
- Install.zip (2.4 MB) A compressed "zip" file containing the installation files
- Package.zip (2.4 MB) A compressed "zip" file containing the support package that can be used to create a new installation package
- VB6Code.zip (45 KB) A compressed "zip" file containing the Visual Basic 6.0 source code, which can be read with a text editor.
Support for this software includes on-line training modules, limited software support, and compilation of suggested improvements. Only limited assistance can be provided for applying KTRLine to specific problems, but the on-line training modules should be sufficient for most users.
On-Line Training Modules
The on-line training modules are in the executable Captivate-Multimedia file format in two screen resolutions. The medium resolution version is for screens greater than 800X600 pixels and the high resolution version is for screens greater than 1024 by 768 pixels. You must have the Adobe Flash player to use these files. The training modules explain the theory and application of the software.
- Introduction to the KTRLine method (9 min) medium resolution (A 5.4 MB file) high resolution (A 5.5 MB file)
- Use of the file input form (7 min) medium resolution (A 3.4 MB file) high resolution (A 3.5 MB file)
- Use of the interpretive graphing and model specification form (25 min) medium resolution (A 12.5 MB file) high resolution (A 12.8 MB file)
Limited support is provided for correcting bugs and clarification of how the code is intended to work. For support or to provide feedback or suggestions for improvement, contact Greg Granato.
This software and related material (data and documentation) are made available by the USGS to be used in the public interest and the advancement of science. You may, without any fee or cost, use, copy, modify, or distribute this software, and any derivative works thereof, and its supporting documentation, subject to the USGS Software User Rights Notice
Any use of trade, product, or firm names is for decriptive purposes only and does not imply endorsement by the U.S. Government.
|Title||KTRLine: Kendall-Theil Robust Line - Software page|
|Product Type||Software Release|
|Record Source||USGS Digital Object Identifier Catalog|