📄 alan miller's fortran software.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0036)http://users.bigpond.net.au/amiller/ -->
<HTML><HEAD><TITLE>Alan Miller's Fortran Software</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2900.2722" name=GENERATOR></HEAD>
<BODY text=#0000ff>
<CENTER>
<H1><U>Software from <BR>Alan J. Miller<BR><BR><FONT size=4>Logistic Regression;
TOMS algorithms;<BR>Special code for F and NAS compilers; Miscellaneous other
code;<BR>Applied Statistics Algorithms</U></H1></CENTER>
<P><BR>N.B. Most of this software is compatible with Lahey's ELF90 compiler, and
hence should be compatible with any full Fortran 90 or 95 compiler.
<HR>
<P>
<H2>
<CENTER>What's New?</CENTER></H2>
<P><FONT size=3>
<LI>2004 February 4. Added hartly2d.f90 for the 2D Hartley FFT transform.
<LI>2004 January 14. Added link to Michel Olagnon's ORDERPACK.
<LI>2004 January 7. Added Applied Statistics algorithm AS155 for the
distribution of a linear combination of non-central ch-squared variables.
<LI>2003 December 17. Added Applied Statistics algorithm AS110 for fitting a
straight line using the Lp-norm, and AS285 for evaluating multivariate normal
integrals over an area defined in a user-supplied function.
<LI>2003 December 5. Added Applied Statistics algorithm AS60 which calculates
the eigenvalues/vectors of a real symmetric matrix, and AS304 for Fisher's
non-parametric randomization test for two small independent random samples.
<LI>2003 November 17. Added the singular-value decomposition (SVD) code from the
NSWC library.
<LI>2003 September 11. Deleted t_dprand.f90 - test for a random number
generator.
<LI>2003 August 21. Added TOMS algorithm 703 for the solution of systems of
ODE's.
<LI>2003 August 16. Minor changes to ELSUNC for non-linear least-squares.
<LI>2003 August 13. Added FFT235 for the FFT when the series length has factors
of 2, 3 or 5 (e.g. numbers such as 24, 360, 3600, etc.).
<LI>2003 August 9. Corrected calculation of chi-squared in logistic.f90.
<LI>2003 July 17. Added NSWC routine HBRD for solving sets of nonlinear
equations, based upon the MINPACK routine HYBRD1, and my version of Jerry
Friedman's MACE package for determining optimal transformations in regression
using alternating conditional expectations.
<LI>2003 July 15. Added NSWC routines for the solution of sparse linear
equations, and for finding a zero of a user-supplied function in a specified
range.
<LI>2003 July 14. Added Applied Statistics algorithms 157 for the runs-up and
runs-down tests, and 227 which generates all N-bit binary codes.
<LI>2003 July 9. Added a simple FFT routine from netlib, for the case in which
the series length is a power of 2.
<LI>2003 July 5. Added Applied Statistics algorithm AS63 for the incomplete beta
function.
<LI>2003 July 4. Added Applied Statistics algorithms 177 and 260.
<LI>2003 June 21. Added link to John Monahan's web site.
<LI>2003 June 19. Added Applied Statistics algorithm AS132 for fitting a
straight line minimizing the sum of absolute deviations.
<LI>2003 June 16. Added routines from the NSWC library for solving moderately
large systems of simultaneous linear equations, and for the solution of Toeplitz
systems of linear equations.
<LI>2003 June 13. Added TOMS algorithm 760 for interpolation from a rectangular
grid of data.
<LI>2003 June 11. Added Applied Statistics algorithm 290 for calculating
confidence regions in non-linear regression.
<LI>2003 June 5. Added TOMS algorithm 725 for multivariate normal integrals.
<LI>2003 June 3. Added CACM algorithm 125 for the calculation of Gaussian
weights and ordinates.
<LI>2003 June 2. Corrected my version of RPOLY (CACM algorithm 493) for the
solution of polynomial equations.
<LI>2003 May 20. Added the FFT from the NSWC library.
<LI>2003 April 26. Added Applied Statistics algorithm 207 for fitting general
log-linear models.
<HR>
<P>
<H2>
<CENTER>Subset Selection in Regression</CENTER></H2>
<P><FONT size=3>
<P>The 2nd edition of my book on this subject was published by CRC Press
(Chapman & Hall) in April 2002 (ISBN 1-58488-171-2). Dr. David Smith from
the Medical College of Georgia, USA, has notified me of certain missing
references. Here they are in <A
href="http://users.bigpond.net.au/amiller/book/add_refs.ps">postscript</A> and
<A href="http://users.bigpond.net.au/amiller/book/add_refs.pdf">pdf</A> formats.
<P>As I can no longer access my ozemail web site, I shall make the latest
versions of my subsets software available here. </P>
<LI><A href="http://users.bigpond.net.au/amiller/lsq/lsq.f90">lsq.f90</A> is the
latest version of my uncontrained weighted least-squares module. It is an
upgraded version of Applied Statistics algorithm AS 274. It uses planar
rotations to produce an upper-triangular factorization. The routine INCLUD is
called once for each case in the data set. It is suitable for situations in
which the least-squares calculations have to be updated each time more
observations become available. It has routines for automatically setting up
tolerances and testing for singularities. It uses a version of rank-revealing QR
decomposition for this. This code is now compatible with ELF90.
<P></P>
<P>If results for a subset of predictor variables are required, those variables
are moved to the first positions, and variables to be excluded are ordered after
them. Routine VMOVE moves one variable; routine REORDR re-orders the variables
so that those listed are in the first positions, though not necessarily in the
order specified. </P>
<P>For further details on how to use the module and on methods of least-squares
calculation refer to the document </P>
<LI><A href="http://users.bigpond.net.au/amiller/lsq/lsq.doc">lsq.doc</A>.
<P></P>
<P>There is a <A href="http://users.bigpond.net.au/amiller/lsq/demo.f90">DEMO
program</A> which uses a simple data set <A
href="http://users.bigpond.net.au/amiller/lsq/fuelcons.dat">fuelcons.dat</A>,
and a nasty test program <A
href="http://users.bigpond.net.au/amiller/lsq/test1.f90">test1.f90</A>. <BR>If
you want to see more tests then download the zip file <A
href="http://users.bigpond.net.au/amiller/lsq/tests.zip">tests.zip</A> and the
set of data files used by these tests in <A
href="http://users.bigpond.net.au/amiller/lsq/testdata">testdata</A>. </P>
<LI><A
href="http://users.bigpond.net.au/amiller/lsq/find_sub.f90">find_sub.f90</A> is
a module for finding subsets of variables using a variety of different
algorithms.
<LI><A href="http://users.bigpond.net.au/amiller/lsq/subset.f90">subset.f90</A>
is a driver program which uses the above two modules. I have also made available
the data set <A
href="http://users.bigpond.net.au/amiller/lsq/pollute.dat">pollute.dat</A> of
mortality rates against socio-economic, meteorological and pollution variables
for 60 statistical areas in the USA.
<P>For subset selection using the L1-norm, that is minimizing the sum of
absolute residuals, here is <A
href="http://users.bigpond.net.au/amiller/toms/toms615.f90">toms615.f90</A>
which is a translation of TOMS algorithm 615 to make it ELF90 compatible. There
is also a driver program <A
href="http://users.bigpond.net.au/amiller/toms/test615.f90">test615.f90</A>,
some test data <A
href="http://users.bigpond.net.au/amiller/toms/test615.dat">test615.dat</A>, and
the expected output <A
href="http://users.bigpond.net.au/amiller/toms/test615.out">test615.out</A>.
<P>For linear regression, but when the regression coefficients must be positive
or zero, there is the Lawson & Hanson non-negative least-squares routine <A
href="http://users.bigpond.net.au/amiller/lsq/nnls.f90">nnls.f90</A> N.B. Two
call arguments have been removed from the Fortran 77 version. This routine is
ELF90-compatible.<BR>I have also added my own <A
href="http://users.bigpond.net.au/amiller/lsq/nonnegls.f90">nonnegls.f90</A>
routine which is called after a QR-factorization has been formed using module
LSQ. The file <A
href="http://users.bigpond.net.au/amiller/lsq/t_nnls.f90">t_nnls.f90</A> uses
both of these routines. </P>
<P></P>
<HR>
<P>
<H2>
<CENTER>Random Numbers</CENTER></H2>
<P><FONT size=3>For code for random number generation from the uniform
distribution, and others, including normal, exponential, Poisson, binomial,
gamma and others, <A
href="http://users.bigpond.net.au/amiller/random.html">Click here</A>
<HR>
<P>
<H2>
<CENTER>Quadruple precision</CENTER></H2>
<P><FONT size=3>For code for quadruple precision arithmetic, using pairs of
double precision numbers, <A
href="http://users.bigpond.net.au/amiller/quad.html">Click here</A>
<HR>
<P>
<H2>
<CENTER>Some Applied Statistics Algorithms</CENTER></H2>
<P><FONT size=3>For many years, the Royal Statistical Society published
algorithms in its journal `Applied Statistics'. I have translated a few of these
to F90, <A href="http://users.bigpond.net.au/amiller/apstat.html">Click here</A>
<HR>
<P>
<H2>
<CENTER>Logistic Regression</CENTER></H2>
<P><FONT size=3>
<HR>
I have received several requests for Fortran code to perform logistic
regression, that is to fit:<BR>
<CENTER>p = F/(1 + F)<BR>where<BR>p = the probability that a case is in one of
two categories<BR>F = exp(b0 + b1.X1 + b2.X2 + ... + bk.Xk)<BR>X1, X2, ..., Xk
is a set of k predictors, and<BR>b0, b1, b2, ..., bk is a set of coefficients to
be fitted.</CENTER><FONT size=2>
<UL>
<LI><A
href="http://users.bigpond.net.au/amiller/logistic/logistic.f90">logistic.f90</A>
Module for performing the weighted least squares calculations. It requires my
least squares module <A
href="http://users.bigpond.net.au/amiller/lsq/lsq.f90">lsq.f90</A>
<LI><A
href="http://users.bigpond.net.au/amiller/logistic/t_lgstc1.f90">t_lgstc1.f90</A>
Driver program which uses the data set <A
href="http://users.bigpond.net.au/amiller/logistic/birthwt.dat">birthwt.dat</A>
from Appendix 1 of Hosmer & Lemeshow's book `Applied Logistic Regression'.
<LI><A
href="http://users.bigpond.net.au/amiller/logistic/t_lgstc2.f90">t_lgstc2.f90</A>
Driver program which uses the data set <A
href="http://users.bigpond.net.au/amiller/logistic/surgical.dat">surgical.dat</A>.
This illustrates the use of logistic regression with grouped data. There is an
error in the published data (deliberately NOT corrected here) which has caused
grief with several well-known statistical packages.
<LI><A
href="http://users.bigpond.net.au/amiller/logistic/t_lgstc3.f90">t_lgstc3.f90</A>
Driver program which uses the data set <A
href="http://users.bigpond.net.au/amiller/logistic/clearcut.dat">clearcut.dat</A>.
This illustrates the case in which there is a linear boundary such that all
cases on one side are in one category, and all cases on the other side are in
the other category.
<LI><A
href="http://users.bigpond.net.au/amiller/logistic/se_lgstc.f90">se_lgstc.f90</A>
The standard errors reported by logistic.f90 are often larger than those
reported by other packages for logistic regression. This simple simulation
program shows that those reported here are about right. It also illustrates
the bias in the slope parameters (they are always biased towards being too
large). </LI></UL>
<HR>
<P>
<H2>
<CENTER>Miscellaneous TOMS (and CACM) algorithms</CENTER></H2>
<P><FONT size=3>N.B. I have been asked to provide a link to the <A
href="http://www.acm.org/pubs/copyright_policy/softwareCRnotice.html">copyright
policy of the ACM</A>. Loosely paraphrased, this allows use, and modification,
of the TOMS algorithms for most non-commercial purposes. It also emphasizes that
the ACM accepts no responsibility for the accuracy of the code.
<HR>
I have updated some of the Transactions on Mathematical Software (TOMS)
algorithms to Fortran 90. <A
href="http://users.bigpond.net.au/amiller/toms.html">Click here</A>
<HR>
<P>
<H2>
<CENTER>Code converted from the</A></CENTER></H2>
<P>
<H2>
<CENTER>Naval Surface Warfare Center Math. Library</A></CENTER></H2>
<P><FONT size=2>
<HR>
<UL>
<LI><A
href="http://users.bigpond.net.au/amiller/NSWC/cgamma.f90">cgamma.f90</A>
Complex gamma function.
<LI><A href="http://users.bigpond.net.au/amiller/NSWC/erf.f90">erf.f90</A> The
error function.
<LI><A href="http://users.bigpond.net.au/amiller/NSWC/dcerf.f90">dcerf.f90</A>
Complex error function & its complement.
<LI><A
href="http://users.bigpond.net.au/amiller/NSWC/cexpli.f90">cexpli.f90</A>
Exponential integral for complex argument.
<LI><A
href="http://users.bigpond.net.au/amiller/NSWC/cbsslj.f90">cbsslj.f90</A>
Complex Bessel function J_{\nu}(z) where both the argument, z, and the order,
\nu, are complex.
<LI><A href="http://users.bigpond.net.au/amiller/NSWC/dple.f90">dple.f90</A>
Solution of systems of linear equations using the Henderson-Wassyng partial
pivot algorithm. Includes a test program to solve 100 simultaneous equations.
The user must provide a subroutine to supply any requested row of the matrix.
<LI><A
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -