Rev 6098 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
c-----------------------------------------------------------------------cc R : A Computer Langage for Statistical Data Analysisc Copyright (C) 1996, 1997 Robert Gentleman and Ross Ihakacc This program is free software; you can redistribute it and/or modifyc it under the terms of the GNU General Public License as published byc the Free Software Foundation; either version 2 of the License, orc (at your option) any later version.cc This program is distributed in the hope that it will be useful,c but WITHOUT ANY WARRANTY; without even the implied warranty ofc MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See thec GNU General Public License for more details.cc You should have received a copy of the GNU General Public Licensec along with this program; if not, write to the Free Softwarec Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USAcc-----------------------------------------------------------------------cc lminfl computes basic quantities useful for computingc regression diagnostics.cc on entrycc x double precision(ldx,k)c the qr decomposition as computed by dqrdc or dqrdc2.cc ldx integerc the leading dimension of the array x.cc n integerc the number of rows of the matrix x.cc k integerc the number of columns in the matrix k.cc qraux double precision(k)c auxiliary information about the qr decomposition.cc b double precision(k)c the least-squares parameter estimates.cc resid double precision(k)c the residuals from the regression.cc on returncc hat double precision(n)c the diagonal of the hat matrix.cc coef double precision(n,p)c a matrix which has as i-th row contains the estimatedc regression coefficients when the i-th case is omittedc from the regression.cc sigma double precision(n)c the i-th element of sigma contains an estimatec of the residual standard deviation for the model withc the i-th case omitted.cc This version dated Aug 24, 1996.c Ross Ihaka, University of Auckland.csubroutine lminfl(x, ldx, n, k, qraux, resid, hat, coef, sigma)integer ldx, n, kdouble precision x(ldx,k), qraux(k), resid(n),+ hat(n), coef(n,k), sigma(n)cinteger i, j, infodouble precision sum, denom, dummycc hat matrix diagonalcdo 10 i = 1,nhat(i) = 0.0d010 continuedo 40 j = 1,kdo 20 i = 1,nsigma(i) = 0.0d020 continuesigma(j) = 1.0d0call dqrsl(x, ldx, n, k, qraux, sigma, sigma, dummy,. dummy, dummy, dummy, 10000, info)do 30 i = 1, nhat(i) = hat(i)+sigma(i)*sigma(i)30 continue40 continuecc changes in the estimated coefficientscdo 70 i = 1,ndo 50 j = 1,nsigma(j) = 0.0d050 continuesigma(i) = resid(i)/(1.0d0 - hat(i))call dqrsl(x, ldx, n, k, qraux, sigma, dummy, sigma,. dummy, dummy, dummy, 1000, info)call dtrsl(x, ldx, k, sigma, 1, info)do 60 j = 1,kcoef(i,j) = sigma(j)60 continue70 continuecc estimated residual standard deviationcdenom = (n - k - 1)sum = 0.0d0do 80 i = 1,nsum = sum + resid(i)*resid(i)80 continuedo 90 i = 1,nsigma(i) = sqrt((sum - resid(i)*resid(i)/(1.0d0-hat(i)))/denom)90 continuereturnend