TABLE OF CONTENTS


fortran/fprofgr [ Methods ]

NAME

  fprofgr --- compute profile likelihood gradient

FUNCTION

Compute profile likelihood of regression parameters for a single process. See also the R function mkproflik.

SYNOPSIS

219       subroutine fprofgr(betahat,index,delta,times,Z,as,Uijmat,d,
220      $ ncovs,nr,ns,m,maxj,gr)

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 actual time span for each row (double)
    Z          d x ncovs matrix of covariates (as a double row vector)
    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

    gr         ncovs vector for output

SOURCE

222       integer d,ncovs,nr,ns,nk,m,maxj
223       integer index(d,6)
224       double precision betahat(ncovs)
225       double precision delta(d),times(d)
226       double precision Z(d,ncovs)
227       double precision Uijmat(m,maxj)
228       double precision lp,deltat,gr(ncovs)
229       double precision mrs(nr,ns)
230       double precision mrsgr(nr,ns,ncovs)
231       double precision as(nr,ns)
232       integer ind,i,j,k,r,s,smax,smin
233 
234       parameter(icol=1, jcol=2, kcol=3, ircol=4, ismincol=5, ismaxcol=6)
235       
236       call fmkmrs(betahat,index,times,Z,as,Uijmat,d,ncovs,nr,ns,
237      $  m,maxj,mrs,mrsgr,1)
238       
239       lik=0.d0
240       do 100 ind=1,d
241         i=index(ind,icol)
242         j=index(ind,jcol)
243         k=index(ind,kcol)
244         r=index(ind,ircol)
245         smin=index(ind,ismincol)
246         smax=index(ind,ismaxcol)
247         deltat=delta(ind)
248         if(deltat.EQ.1.d0) then
249             call daxpy(ncovs,1.d0,Z(ind,1),d,gr,1)
250             call daxpy(ncovs,-1.d0/mrs(r,smax),mrsgr(r,smax,1),
251      $                 nr*ns,gr,1)
252         endif
253  100  continue
254       end