Skip to content

Commit

Permalink
Update NMreadExt.R
Browse files Browse the repository at this point in the history
Making requested updates to NMreadExt for calculating iblock and blocksize
  • Loading branch information
bmreilly authored Dec 3, 2024
1 parent 8834a9d commit 4a87c54
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions R/NMreadExt.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,15 @@ NMreadExt <- function(file,return,as.fun,modelname,col.model,auto.ext,tableno="m
pars[,est:=value]

### add OMEGA block information based on off diagonal values
tab.blocks <- rbind(pars[par.type%in%c("OMEGA","SIGMA"),.(par.type,i=i,j=j,value)],
pars[par.type%in%c("OMEGA","SIGMA"),.(par.type,i=j,j=i,value)])[
abs(value)>1e-9,.(iblock=min(i,j)
# ,blocksize=max(abs(j-i))+1
),by=.(par.type,i)]
tab.blocks[,blocksize:=length(i),by=.(par.type,iblock)]
tab.i <- rbind(pars[par.type%in%c("OMEGA","SIGMA"),.(par.type,i=i,j=j,value)],
pars[par.type%in%c("OMEGA","SIGMA"),.(par.type,i=j,j=i,value)])[
# include i==j so that if an OMEGA is fixed to zero it is still assigned an iblock
i==j|abs(value)>1e-9,.(iblock=min(i,j)),by=.(par.type,i)]
tab.i[,blocksize:=.N,by=.(par.type,iblock)]

## pars0 <- copy(pars)
## tab.blocks
pars <- mergeCheck(pars,tab.blocks,by=cc(par.type,i),all.x=T,quiet=TRUE)
pars <- mergeCheck(pars,tab.i,by=cc(par.type,i),all.x=T,quiet=TRUE)

## pars[par.type%in%c("OMEGA","SIGMA"),.(i,j,iblock,blocksize,value)]

Expand Down

0 comments on commit 4a87c54

Please sign in to comment.