Skip to content

Commit

Permalink
Merge pull request #50 from bmreilly/master
Browse files Browse the repository at this point in the history
NMreadExt was incorrectly calculating blocksize for OMEGAs, I proposed a fix
  • Loading branch information
philipdelff authored Dec 3, 2024
2 parents 0ed1e04 + 4a87c54 commit 29d0c1e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions R/NMreadExt.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,16 @@ NMreadExt <- function(file,return,as.fun,modelname,col.model,auto.ext,tableno="m
## est is just a copy of value for backward compatibility
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)]
### add OMEGA block information based on off diagonal values
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 29d0c1e

Please sign in to comment.