TABLE OF CONTENTS
fortran/fsmuij [ Methods ]
NAME
fsmuij --- compute sums of events and means
FUNCTION
Compute the sums of mu_rijks and delta_rijks for every (i,j). See also the R function Smuij.
SYNOPSIS
281 subroutine fsmuij(betahat,index,delta,Z,alphars,as, 282 $ d,ncovs,nr,ns,m,maxj,Smu,Sdelta)
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) Z d x ncovs matrix of covariates (double row vector) alphars nr x ns matrix of baseline hazards (double) 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
Smu m x maxj matrix containg sum(mu_rijks) for all (i,j) Sdelta m x maxj matrix containg sum(delta_rijks) for all (i,j)
SOURCE
284 integer d,ncovs,nr,ns,nk,m,maxj 285 integer index(d,6) 286 double precision betahat(ncovs) 287 double precision delta(d) 288 double precision Z(d,ncovs) 289 double precision alphars(nr,ns) 290 double precision as(nr,ns) 291 double precision lp, deltat,w,mu,power 292 double precision Smu(m,maxj),Sdelta(m,maxj) 293 integer ind,i,j,k,r,s,smax,smin,maxs 294 295 parameter(icol=1, jcol=2, kcol=3, ircol=4, ismincol=5, ismaxcol=6) 296 297 maxs=(ns-1)*95/100 298 do 100 ind=1,d 299 ! call intpr("ind",-1,ind,1) 300 i=index(ind,icol) 301 j=index(ind,jcol) 302 k=index(ind,kcol) 303 r=index(ind,ircol) 304 smin=index(ind,ismincol) 305 smax=index(ind,ismaxcol) 306 deltat=delta(ind) 307 lp=ddot(ncovs,Z(ind,1),d,betahat,1) 308 ! ignore the last 5% of intervals 309 ! if(smax.GT.maxs) then 310 ! smax=maxs 311 ! endif 312 Sdelta(i,j)=Sdelta(i,j)+deltat 313 do 110 s=smin,smax 314 mu=exp(lp)*alphars(r,s)*(as(r,s+1)-as(r,s)) 315 mu=(1.d0-exp(-mu)) 316 Smu(i,j)=Smu(i,j)+mu 317 110 continue 318 100 continue 319 end