Reading data



Hi,

I am new to Fortran. Tried to write an OLS regression using the
following data:
12 39
10 42
6 33
15 43
8 35
13 35
11 33
16 44
12 37
9 34

PROGRAM REGRESSION
PARAMETER (M=10)
INTEGER I, N
REAL Y(M), X(M), ALPHA, BETA
REAL YSUM, XSUM, YXSUM, XXSUM
OPEN (UNIT=6,FILE='EXAMPLE2.CSV')
OPEN (UNIT=7, FILE='OUTPUT.DAT')
N=M
DO 10, I=1,N
READ (6, *) Y(I), X(I)
10 CONTINUE
CALL LSTSQR (Y, X, N, ALPHA, BETA)
WRITE (7, 200), ALPHA, BETA
200 FORMAT(/5X, 'ALPHA IS', F7.3,/
5X, 'BETA IS', F7.3)
STOP
END
SUBROUTINE LSTSQR(Y, X, N, A, B)
PARAMETER (M=10)
INTEGER N, I
REAL Y(M), X(M), A, B
REAL YSUM, XSUM, YXSUM, XXSUM
XSUM=0.0
YSUM=0.0
YXSUM=0.0
XXSUM=0.0
DO 10, I=1, N
XSUM=XSUM+X(I)
YSUM=YSUM+Y(I)
YXSUM=YXSUM+X(I)*Y(I)
XXSUM=XXSUM+X(I)**2
10 CONTINUE
A=(XSUM*YSUM-N*XYSUM)/(XSUM**2-N*XXSUM)
B=(YSUM-A*XSUM)/N
RETURN
END

The error was:

list in: end of file
apparent state: unit 6 named EXAMPLE2.CSV
last format: list io
lately reading direct formatted external IO
Aborted

Anyone can help me out? Thanks.

.



Relevant Pages

  • Re: Reading data
    ... Tried to write an OLS regression using the ... CALL LSTSQR (Y, X, N, ALPHA, BETA) ... last format: list io ...
    (comp.lang.fortran)
  • I forget the Induction Joke ...
    ... Drama in one act with 4 characters: The Grand Alpha, The Grand Beta, ... The Grand Omicron, and The Candidate. ... Please define a compact set. ...
    (rec.org.mensa)
  • Re:Re: Alpha, beta, ....
    ... Firefox 3 was done at alpha 3 (when i never hit a bug again and it pa? ... hanges to beta 1. ... I for one was happy to see Firefox 3 as in 7.10, ... There must be a different than gnash tool to play swf as I don't have gnash? ...
    (Ubuntu)
  • Re: The Dangerous Liberty of Engineering vs. Lukewarm Dominionism
    ... with alpha, beta, and gamma also part of a smooth mani- ... violates CPT invariance, ...
    (sci.space.policy)
  • Re: Accessing an invoking classs getters?
    ... >> from Alpha to Beta, even a fairly long list of values, ... > If there's no other relation between an instance of an Alpha and a Beta, ... > this would be the prefered method, as you then decouple the dependence to ... should probably be called AlphaPreferences, ...
    (comp.lang.java.programmer)