NAG Library Manual, Mark 30.2
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program g07befe

!     G07BEF Example Program Text

!     Mark 30.2 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g07bef, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: beta, corr, dev, gamma, sebeta,      &
                                          segam, tol
      Integer                          :: ifail, lic, maxit, n, nit
      Character (1)                    :: cens
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: wk(:), x(:)
      Integer, Allocatable             :: ic(:)
!     .. Executable Statements ..
      Write (nout,*) 'G07BEF Example Program Results'
      Write (nout,*)

!     Skip heading in data file
      Read (nin,*)

!     Read in the problem size and control parameters
      Read (nin,*) cens, n, tol, maxit

      If (cens=='N' .Or. cens=='n') Then
        lic = 0
      Else
        lic = n
      End If
      Allocate (x(n),ic(lic),wk(n))

!     Read in data
      Read (nin,*) x(1:n)

!     Read in censor flag if required
      If (lic>0) Then
        Read (nin,*) ic(1:n)
      End If

!     Read in initial estimate of GAMMA
      Read (nin,*) gamma

!     Calculate estimates
      ifail = 0
      Call g07bef(cens,n,x,ic,beta,gamma,tol,maxit,sebeta,segam,corr,dev,nit,  &
        wk,ifail)

!     Display results
      Write (nout,99999) ' BETA  = ', beta, ' Standard error = ', sebeta
      Write (nout,99999) ' GAMMA = ', gamma, ' Standard error = ', segam

99999 Format (1X,2(A,F10.4))
    End Program g07befe