anchor.diff:  END DO
   END SUBROUTINE 
   
  -!********************************************************************
  -SUBROUTINE normal1(vec, mean, variance)
  -!
  -!This subroutine generates a univariate sample of random numbers form N(mean, variance)
  -!using the Box-Muller algorithm.
  -!
  -IMPLICIT NONE
  -!Defining arguments
  -REAL, INTENT(OUT)	:: vec(:,:)
  -REAL, INTENT(IN)		:: mean(:), variance(:,:)
  -!Defining local variables
  -REAL, PARAMETER		:: pi = 3.1415926
  -REAL, ALLOCATABLE    :: u(:), r(:)
  -INTEGER   			:: g, i, s
  -!Algorithm
  -s = size(vec,1) 
  -ALLOCATE(u(2*s))
  -ALLOCATE(r(2*s))
  -CALL random_number(u)
  -DO g = 1, 2*s, 2
  -   r(g) 	= sqrt(-2*log(u(g)))*cos(2*pi*u(g+1)) 
  -   r(g+1)	= sqrt(-2*log(u(g)))*sin(2*pi*u(g+1)) 
  -END DO
  -DO i = 1,s 
  -   vec(i,1) = mean(1) + sqrt(variance(1,1))*r(i)			
  -END DO
  -END SUBROUTINE normal1
  -
  -!********************************************************************
  -SUBROUTINE RNNOR(dim, draw)
  -!
  -! This subroutine draws a single deviate from a  mutlivariate normal distribution with mean zero.
  -!
  -IMPLICIT NONE
  -!Defining arguments
  -INTEGER, INTENT(IN)				:: dim
  -REAL, INTENT(OUT)				:: draw(4)
  -!Defining local variables
  -INTEGER				:: g, n, i
  -REAL			:: zero(1) = 0.0, one(1,1) = 1.0, z(4,1)
  -!Algorithm
  -CALL normal1(z, zero, one)
  -
  -draw = z(:,1)
  -
  -END SUBROUTINE 
  -
  -
  -!********************************************************************
  +  !***************************************************************************** 
  +  !***************************************************************************** 
  +  SUBROUTINE RNNOR(dim, draw)
  +
  +    !
  +    ! This subroutine generates deviates from a standard normal distribution using 
  +    ! the Box-Muller algorithm.
  +    !
  +
  +    !/* external objects    */
  +
  +    INTEGER, INTENT(IN)	:: dim
  +
  +    REAL, INTENT(OUT)   :: draw(dim)
  +    
  +    !/* internal objects    */
  +
  +    INTEGER             :: g 
  +
  +    REAL, PARAMETER     :: pi = 3.141592653589793238462643383279502884197
  +    REAL, ALLOCATABLE   :: u(:), r(:)
  +
  +    !--------------------------------------------------------------------------- 
  +    ! Algorithm
  +    !--------------------------------------------------------------------------- 
  +
  +    ! Allocate containers
  +    ALLOCATE(u(2*dim)); ALLOCATE(r(2*dim))
  +
  +    ! Call uniform deviates
  +    CALL random_number(u)
  +
  +    ! Apply Box-Muller transform
  +    DO g = 1, 2*dim, 2
  +
  +       r(g)   = SQRT(-2*LOG(u(g)))*COS(2*pi*u(g+1)) 
  +       r(g+1) = SQRT(-2*LOG(u(g)))*SIN(2*pi*u(g+1)) 
  +
  +    END DO
  +
  +    ! Extract relevant floats
  +    DO g = 1, dim 
  +
  +       draw(g) = r(g)     
  +
  +    END DO
  +
  +  END SUBROUTINE 
  +
  +!*******************************************************************************
  +!*******************************************************************************
   SUBROUTINE RNSET(a)
   !
   ! St random seed
  
positive.code:       INTEGER X1,X2,E,T
  
  
  ! Open files
  open(9,file='in1a.txt')
    
  open(10,file='otest.txt')
    
  open(11,file='ftest.txt')
  
  
        READ(9,1500) NPER,NPOP,DRAW,DRAW1,TAU
  
negative.code:   ! The input and output connections are opened and the commenting
    ! style is changed to comply with the FORTRAN95 standard. Line
    ! breaks are removed.
    !***************************************************************************** 
  
    ! Interface to IMSL replacements
    USE IMSL_REPLACEMENTS
    
  !********************************************************
  !*  PROGRAM TO CONSTRUCT MONTE CARLO DATA FOR DP MODEL  *
  