TABLE OF CONTENTS


fortran/fmkalpha2 [ Methods ]

NAME

  fmkalpha2 --- compute baseline hazard

FUNCTION

Compute the MLEs for the baseline hazard parameters alphars, given estimates of regression parameters andf frailties, for a single recurrent event process. See also the R function makealphars2.

SYNOPSIS

421       subroutine fmkalpha2(betahat,index,delta,times,Z,alphars,as,
422      $ Uijmat,d,ncovs,nr,ns,m,maxj)

INPUTS

    betahat    regression parameters (length p)
    index      d x 6 matrix of indices i,j,k,r,smin,smax 
    delta      length d vector of event indicators (double)
    times      length d vector of event times
    Z          d x ncovs matrix of covariates (double row vector)
    alphars    nr x ns matrix of baseline hazards (double) 
    as         nr x ns matrix of discretization breakpoints (double) 
    Uijmat     m x maxj matrix of frailty estimates (double row vector)
    d          number of rows of Z
    ncovs      number of covariates
    nr         number of strata
    ns         number of breakpoints
    m          number of clusters
    maxj       largest cluster size

OUTPUTS

    alphars updated with baseline hazard MLEs

SOURCE

424       integer d,ncovs,nr,ns,m,maxj
425       integer index(d,6)
426       double precision betahat(ncovs)
427       double precision delta(d),times(d)
428       double precision Z(d,ncovs)
429       double precision alphars(nr,ns)
430       double precision as(nr,ns)
431       double precision Uijmat(m,maxj)
432       double precision pred,thisA,time
433       double precision Srs(nr,ns), drs(nr,ns)
434       integer ind,i,j,k,r,s,smax,smin
435       
436       parameter(icol=1, jcol=2, kcol=3, ircol=4, ismincol=5, ismaxcol=6)
437       
438       call dzero(Srs,nr*ns)
439       call dzero(drs,nr*ns)
440 
441       do 100 ind=1,d
442         i=index(ind,icol)
443         j=index(ind,jcol)
444         k=index(ind,kcol)
445         r=index(ind,ircol)
446         smin=index(ind,ismincol)
447         smax=index(ind,ismaxcol)
448         deltat=delta(ind)
449         time=times(ind)
450         pred=exp(ddot(ncovs,Z(ind,1),d,betahat,1))*Uijmat(i,j)
451         drs(r,smax)=drs(r,smax)+deltat
452         do 110 s=smin,smax
453             thisA=0.d0
454             call A(thisA,time,as,r,s,nr,ns)
455             Srs(r,s)=Srs(r,s)+pred*thisA
456  110    continue
457  100  continue
458 
459       do 200 r=1,nr
460         do 210 s=1,ns
461             if(Srs(r,s).EQ.0.d0) then
462                 alphars(r,s)=100.d0
463             else
464                 alphars(r,s)=drs(r,s)/Srs(r,s)
465             endif
466  210    continue
467  200  continue
468       end