From 8834a9d9abebe0a9b480900a89b12d331071caad Mon Sep 17 00:00:00 2001 From: Brian Reilly Date: Tue, 3 Dec 2024 13:10:32 -0500 Subject: [PATCH 1/2] NMreadExt was incorrectly calculating blocksize for OMEGAs, I proposed a fix --- R/NMreadExt.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/NMreadExt.R b/R/NMreadExt.R index 9e143029..4a4e53f5 100644 --- a/R/NMreadExt.R +++ b/R/NMreadExt.R @@ -207,10 +207,13 @@ 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 + ### 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)] + 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)] ## pars0 <- copy(pars) ## tab.blocks From 4a87c54fc7c7c5388b33fd2378ade586cab80ace Mon Sep 17 00:00:00 2001 From: Brian Reilly Date: Tue, 3 Dec 2024 14:11:38 -0500 Subject: [PATCH 2/2] Update NMreadExt.R Making requested updates to NMreadExt for calculating iblock and blocksize --- R/NMreadExt.R | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/R/NMreadExt.R b/R/NMreadExt.R index 4a4e53f5..6d92c8b1 100644 --- a/R/NMreadExt.R +++ b/R/NMreadExt.R @@ -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)]